{"id":13763898,"url":"https://github.com/proyecto26/animatable-component","last_synced_at":"2025-04-08T09:07:20.394Z","repository":{"id":40773329,"uuid":"217956758","full_name":"proyecto26/animatable-component","owner":"proyecto26","description":"Animate once, use Everywhere! 💫","archived":false,"fork":false,"pushed_at":"2024-10-27T16:17:04.000Z","size":2057,"stargazers_count":255,"open_issues_count":21,"forks_count":16,"subscribers_count":12,"default_branch":"develop","last_synced_at":"2024-10-29T22:37:27.384Z","etag":null,"topics":["animation","animation-library","animations","declarative","designer-website","designers","pwa","stencil","stencil-components","stenciljs","stenciljs-components","transitions","ux","ux-experience","waapi","web","web-animation","web-animations","web-animations-api","web-components"],"latest_commit_sha":null,"homepage":"https://proyecto26.github.io/animatable-component","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/proyecto26.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jdnichollsc","patreon":"proyecto26","open_collective":"proyecto26","ko_fi":"proyecto26","liberapay":"proyecto26","donorbox":"proyecto-26","custom":["paypal.me/jdnichollsc","buymeacoffee.com/jdnichollsc","donorbox.org/proyecto-26"]}},"created_at":"2019-10-28T03:11:21.000Z","updated_at":"2024-10-27T16:17:08.000Z","dependencies_parsed_at":"2024-11-05T23:46:35.278Z","dependency_job_id":null,"html_url":"https://github.com/proyecto26/animatable-component","commit_stats":{"total_commits":132,"total_committers":1,"mean_commits":132.0,"dds":0.0,"last_synced_commit":"8ad561a983005e9b51bdad2920780e2b8cb7b818"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proyecto26%2Fanimatable-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proyecto26%2Fanimatable-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proyecto26%2Fanimatable-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proyecto26%2Fanimatable-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proyecto26","download_url":"https://codeload.github.com/proyecto26/animatable-component/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332556,"owners_count":20921853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","animation-library","animations","declarative","designer-website","designers","pwa","stencil","stencil-components","stenciljs","stenciljs-components","transitions","ux","ux-experience","waapi","web","web-animation","web-animations","web-animations-api","web-components"],"created_at":"2024-08-03T15:01:01.348Z","updated_at":"2025-04-08T09:07:20.377Z","avatar_url":"https://github.com/proyecto26.png","language":"TypeScript","readme":"![Built With Stencil](https://img.shields.io/badge/-Built%20With%20Stencil-16161d.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI%2BCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI%2BCgkuc3Qwe2ZpbGw6I0ZGRkZGRjt9Cjwvc3R5bGU%2BCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00MjQuNywzNzMuOWMwLDM3LjYtNTUuMSw2OC42LTkyLjcsNjguNkgxODAuNGMtMzcuOSwwLTkyLjctMzAuNy05Mi43LTY4LjZ2LTMuNmgzMzYuOVYzNzMuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTQyNC43LDI5Mi4xSDE4MC40Yy0zNy42LDAtOTIuNy0zMS05Mi43LTY4LjZ2LTMuNkgzMzJjMzcuNiwwLDkyLjcsMzEsOTIuNyw2OC42VjI5Mi4xeiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNDI0LjcsMTQxLjdIODcuN3YtMy42YzAtMzcuNiw1NC44LTY4LjYsOTIuNy02OC42SDMzMmMzNy45LDAsOTIuNywzMC43LDkyLjcsNjguNlYxNDEuN3oiLz4KPC9zdmc%2BCg%3D%3D\u0026colorA=16161d\u0026style=flat-square)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-brightgreen.svg)](https://github.com/proyecto26/animatable-component/graphs/commit-activity)\n[![NPM version][npm-image]][npm-url]\n[![Downloads][downloads-image]][npm-url]\n[![TotalDownloads][total-downloads-image]][npm-url]\n[![Twitter Follow][twitter-image]][twitter-url]\n\n[npm-image]:http://img.shields.io/npm/v/@proyecto26/animatable-component.svg\n[npm-url]:https://npmjs.org/package/@proyecto26/animatable-component\n[downloads-image]:http://img.shields.io/npm/dm/@proyecto26/animatable-component.svg\n[total-downloads-image]:http://img.shields.io/npm/dt/@proyecto26/animatable-component.svg?label=total%20downloads\n[twitter-image]:https://img.shields.io/twitter/follow/jdnichollsc.svg?style=social\u0026label=Follow%20me\n[twitter-url]:https://twitter.com/jdnichollsc\n\n# `\u003canimatable/\u003e` \n\nWeb Component built with [Stencil.js](https://github.com/ionic-team/stencil) to use [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API) in a declarative way.\nYou can animate any HTML element easily:\n```html\n\u003canimatable-component\n  autoplay\n  easing=\"ease-in-out\"\n  duration=\"800\"\n  delay=\"300\"\n  animation=\"tada\"\n\u003e\n  \u003ch1\u003eHello World\u003c/h1\u003e\n\u003c/animatable-component\u003e\n```\nWith the largest list of [Keyframes](https://developer.mozilla.org/docs/Web/API/Web_Animations_API/Keyframe_Formats)/[Easing Functions](https://developer.mozilla.org/docs/Web/API/EffectTiming/easing) that can also be used with other animation tools or Platforms! 🧚\n\n## Demo 🎮\n\nDo you want to see this web component in action? Visit https://codepen.io/jdnichollsc/full/rNNYBbe yay! 🎉\n\n- Playground: https://codepen.io/jdnichollsc/pen/MWwpGNW\n- Sequence: https://codepen.io/jdnichollsc/full/OJVWyQm\n- Events: https://codepen.io/jdnichollsc/full/wvagEYQ\n- Paths: https://codepen.io/jdnichollsc/full/MWwmBzr\n- Background Position: https://codepen.io/jdnichollsc/full/wvMJyYQ\n- Carousel: https://codepen.io/jdnichollsc/full/zYrpEyR\n- Confetti: https://codepen.io/jdnichollsc/full/RwWVoJN\n- Cube Component: https://codepen.io/jdnichollsc/full/mdervLB\n- Multiple Cubes: https://codepen.io/jdnichollsc/full/XWmaYgM\n- 3D Clock: https://codepen.io/jdnichollsc/full/WNvXaYM\n- Cube Runner: https://codepen.io/jdnichollsc/full/BaQmvxL\n- The illusion of life: \n  * Squash and Stretch: https://codepen.io/jdnichollsc/full/Rwrxjya\n  * Anticipation: https://codepen.io/jdnichollsc/full/dyGJJYX\n  * Appeal: https://codepen.io/jdnichollsc/full/GRprmVv\n- Solar System: https://codepen.io/jdnichollsc/full/yLYogYz\n- Animating other Web Components: https://codepen.io/jdnichollsc/full/mddpzbV\n- WorkShop: https://slides.com/juandavidnicholls/waapi-webcomponents\n- Meet `\u003canimatable /\u003e`, a tiny Web Component: https://dev.to/jdnichollsc/meet-animatable-a-tiny-web-component-to-use-web-animations-api-as-a-component-1glh\n\n![Animatable](https://github.com/proyecto26/animatable-component/blob/develop/img/demo-pwa.png?raw=true)\n\u003e Includes a PWA demo for debugging animations! ▶\n\n## Usage 🎉\n\n- [animatable-component](./src/components/animatable-component/readme.md)\n```html\n\u003canimatable-component autoplay iterations=\"3\" animation=\"heartBeat\" easing=\"ease-in\" duration=\"1000\"\u003e\n  \u003ch1\u003eProof that Tony Stark has a heart ✵\u003c/h1\u003e\n\u003c/animatable-component\u003e\n```\n- [animatable-cube](./src/components/animatable-cube/readme.md)\n```html\n\u003canimatable-cube\n  autoplay\n  fill=\"forwards\"\n  composite=\"add\"\n  duration=\"2600\"\n  easing=\"linear\"\n  iterations=\"Infinity\"\n  fromClassName=\"playing\"\n  toClassName=\"finished\"\n  animation=\"rotate-90-vertical-bck\"\n\u003e\n  \u003cdiv slot=\"front-face\"\u003eFront\u003c/div\u003e\n  \u003cdiv slot=\"back-face\"\u003eBack\u003c/div\u003e\n  \u003cdiv slot=\"right-face\"\u003eRight\u003c/div\u003e\n  \u003cdiv slot=\"left-face\"\u003eLeft\u003c/div\u003e\n  \u003cdiv slot=\"top-face\"\u003eTop\u003c/div\u003e\n  \u003cdiv slot=\"bottom-face\"\u003eBottom\u003c/div\u003e\n\u003c/animatable-cube\u003e\n```\n### With other animation libraries:\n```js\nimport {\n  ANIMATIONS,\n  EASING_FUNCTIONS,\n  EASING,\n  KEYFRAMES\n} from '@proyecto26/animatable-component';\n\nconst bounceKeyFrames = KEYFRAMES[ANIMATIONS.BOUNCE];\nconst easingOutCubic = EASING_FUNCTIONS[EASING.EASE_OUT_CUBIC];\n\n// Use here any other animation tool like Ionic Animations, AnimeJS, GSAP, etc! :)\n```\n\n## Getting Started 📖\n\n### Packages\n\n| Project | Package | Version | Links |\n| ------- | ------- | ------- |:-----:|\n| **Core** | [`@proyecto26/animatable-component`](https://www.npmjs.com/package/@proyecto26/animatable-component) | [![version](https://img.shields.io/npm/v/@proyecto26/animatable-component/latest.svg)](https://www.npmjs.com/package/@proyecto26/animatable-component) | [`README.md`](./README.md)\n| **React** | [`@proyecto26/animatable-component-react`](https://www.npmjs.com/package/@proyecto26/animatable-component-react) | [![version](https://img.shields.io/npm/v/@proyecto26/animatable-component-react/latest.svg)](https://www.npmjs.com/package/@proyecto26/animatable-component-react) | [`README.md`](react/README.md)\n\n### Script tag\n\n- Put a script tag similar to this `\u003cscript src='https://cdn.jsdelivr.net/npm/@proyecto26/animatable-component@1.1.10/dist/animatable-component/animatable-component.esm.js'\u003e\u003c/script\u003e` in the head of your index.html\n- Then you can use the element anywhere in your template, JSX, html etc\n\n### Node Modules\n- Run `npm install @proyecto26/animatable-component --save`\n- Put a script tag similar to this `\u003cscript src='node_modules/@proyecto26/animatable-component/dist/animatable-component/animatable-component.esm.js'\u003e\u003c/script\u003e` in the head of your index.html\n- Then you can use the element anywhere in your template, JSX, html etc\n\n### In a stencil-starter app\n- Run `npm install @proyecto26/animatable-component --save`\n- Add an import to the npm packages `import @proyecto26/animatable-component;`\n- Then you can use the element anywhere in your template, JSX, html etc\n\n## Framework integrations 👨‍💻\n\n### Angular\nUsing `animatable-component` component within an Angular project:\n\n#### Including the Custom Elements Schema\n\nIncluding the `CUSTOM_ELEMENTS_SCHEMA` in the module allows the use of Web Components in the HTML files. Here is an example of adding it to `AppModule`:\n\n```ts\nimport { BrowserModule } from '@angular/platform-browser';\nimport { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';\nimport { AppComponent } from './app.component';\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [BrowserModule],\n  bootstrap: [AppComponent],\n  schemas: [CUSTOM_ELEMENTS_SCHEMA]\n})\nexport class AppModule {}\n```\n\nThe `CUSTOM_ELEMENTS_SCHEMA` needs to be included in any module that uses **Animatable**.\n\n#### Calling defineCustomElements\n\n**Animatable** component includes a function used to load itself in the application window object. That function is called `defineCustomElements()` and needs to be executed once during the bootstrapping of your application. One convenient place to add it is in the `main.ts` file as follows:\n\n```tsx\nimport { enableProdMode } from '@angular/core';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\nimport { defineCustomElements as defineAnimatable } from '@proyecto26/animatable-component/loader';\n\nimport { AppModule } from './app/app.module';\nimport { environment } from './environments/environment';\n\nif (environment.production) {\n  enableProdMode();\n}\n\nplatformBrowserDynamic().bootstrapModule(AppModule)\n  .catch(err =\u003e console.log(err));\ndefineAnimatable(window);\n```\n\n[_from stencil documentation_](https://github.com/ionic-team/stencil-site/blob/master/src/docs/framework-integration/angular.md)\n\n### React\n\n- Specific Wrapper\n\nWhen using a wrapper component, It's not necessary to access the reference directly to attach events, etc. More details [here](./react/README.md).\n```tsx\nimport React from 'react';\nimport {\n  AnimatableComponent,\n  ANIMATIONS,\n  EASING\n} from '@proyecto26/animatable-component-react';\n\nconst App = () =\u003e {\n  return (\n    \u003cAnimatableComponent\n      autoPlay\n      delay={300}\n      duration={800}\n      composite='add'\n      direction='alternate'\n      iterations={Infinity}\n      animation={ANIMATIONS.TADA}\n      easing={EASING.EASE_IN_OUT_BACK}\n      onStart={() =\u003e console.log('Starting animation')}\n      onFinish={() =\u003e console.log('Finished animation')}\n      onCancel={() =\u003e console.log('Cancelled animation')}\n    \u003e\n      \u003cdiv\u003e\n        \u003cp\u003eHELLO WORLD\u003c/p\u003e\n      \u003c/div\u003e\n    \u003c/AnimatableComponent\u003e\n  );\n};\nexport default App;\n```\n\n- Web Component\n\nOther option is using the web component directly: \n```tsx\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport { defineCustomElements as defineAnimatable } from '@proyecto26/animatable-component/loader'\nimport App from './App';\n\nReactDOM.render(\u003cApp /\u003e, document.getElementById('root'));\n\ndefineAnimatable(window);\n```\n\n[_from stencil documentation_](https://github.com/ionic-team/stencil-site/blob/master/src/docs/framework-integration/react.md)\n\n### Vue\n\nIn order to use the `animatable-component` Web Component inside of a Vue application, it should be modified to define the custom elements and to inform the Vue compiler which elements to ignore during compilation. This can all be done within the `main.js` file as follows:\n\n```tsx\nimport Vue from 'vue';\nimport { defineCustomElements as defineAnimatable } from '@proyecto26/animatable-component/loader'\n\nimport App from './App.vue';\n\nVue.config.productionTip = false;\nVue.config.ignoredElements = [/animatable-\\w*/];\n\n// Bind the custom element to the window object\ndefineAnimatable(window);\n\nnew Vue({\n  render: h =\u003e h(App)\n}).$mount('#app');\n```\n\n[_from stencil documentation_](https://github.com/ionic-team/stencil-site/blob/master/src/docs/framework-integration/vue.md)\n\n### Stencil\n\nTo animate [Functional Components](https://stenciljs.com/docs/functional-components) you can use the `createAnimatableComponent` utility, e.g:\n- `utils.tsx`\n```tsx\nimport {\n  createAnimatableComponent\n} from '@proyecto26/animatable-component';\n\nconst SendMessageButton = (props) =\u003e (\n  \u003cion-fab-button {...props}\u003e\n    \u003cion-icon name='send' /\u003e\n  \u003c/ion-fab-button\u003e\n);\nexport const AnimatableSendMessageButton = createAnimatableComponent(SendMessageButton);\nexport const keyFramesSendMessage: Keyframe[] = [\n  {\n    opacity: '0',\n    transform: 'rotate(0deg)'\n  },\n  {\n    opacity: '1',\n    transform: 'rotate(360deg)'\n  }\n];\nexport const optionsSendMessage: KeyframeAnimationOptions = {\n  duration: 500,\n  easing: 'ease-in-out'\n};\n```\n- `my-component.tsx`\n```tsx\nimport { Component, Host, h } from '@stencil/core';\nimport { AnimatableSendMessageButton, keyFramesSendMessage, optionsSendMessage } from './utils'\n\n@Component({\n  tag: 'my-component',\n  shadow: false\n})\nexport class MyComponent {\n  render() {\n    return (\n       \u003cAnimatableSendMessageButton\n        autoPlay\n        keyFrames={keyFramesSendMessage}\n        options={optionsSendMessage}\n        onFinish={() =\u003e alert('Eureka!')}\n      /\u003e\n    )\n  }\n}\n```\n\n## Credits 👍\n* [Animate.css](https://daneden.github.io/animate.css)\n* [Animista](https://animista.net)\n\n## Contributing ✨\nWhen contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.  \nContributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated** ❤️.  \nYou can learn more about how you can contribute to this project in the [contribution guide](https://github.com/proyecto26/animatable-component/blob/develop/CONTRIBUTING.md).\n\n## Supporting 🍻\nI believe in Unicorns 🦄\nSupport [me](http://www.paypal.me/jdnichollsc/2), if you do too.\n\nDonate **Ethereum**, **ADA**, **BNB**, **SHIBA**, **USDT/USDC**, **DOGE**, etc:\n\n\u003e Wallet address: jdnichollsc.eth\n\nPlease let us know your contributions! 🙏\n\n## Enterprise Support 💼\n\nAvailable as part of the Tidelift Subscription.\n\nThe maintainers of `\u003canimatable/\u003e` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-proyecto26-animatable-component?utm_source=npm-proyecto26-animatable-component\u0026utm_medium=referral\u0026utm_campaign=enterprise\u0026utm_term=repo)\n\n## Security contact information 🚨\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.\n\n## License ⚖️\nThis repository is available under the [MIT License](https://github.com/proyecto26/animatable-component/blob/develop/LICENSE).\n\n## Happy coding 💯\nMade with ❤️\n\n\u003cimg width=\"150px\" src=\"https://avatars0.githubusercontent.com/u/28855608?s=200\u0026v=4\" align=\"right\"\u003e\n","funding_links":["https://github.com/sponsors/jdnichollsc","https://patreon.com/proyecto26","https://opencollective.com/proyecto26","https://ko-fi.com/proyecto26","https://liberapay.com/proyecto26","proyecto-26","paypal.me/jdnichollsc","buymeacoffee.com/jdnichollsc","donorbox.org/proyecto-26","http://www.paypal.me/jdnichollsc/2","https://tidelift.com/subscription/pkg/npm-proyecto26-animatable-component?utm_source=npm-proyecto26-animatable-component\u0026utm_medium=referral\u0026utm_campaign=enterprise\u0026utm_term=repo","https://tidelift.com/security"],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproyecto26%2Fanimatable-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproyecto26%2Fanimatable-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproyecto26%2Fanimatable-component/lists"}