{"id":15397006,"url":"https://github.com/ryanhefner/tweenkle","last_synced_at":"2025-04-16T00:38:42.047Z","repository":{"id":65517246,"uuid":"103265476","full_name":"ryanhefner/tweenkle","owner":"ryanhefner","description":"✨ Lightweight tweening library built for modern Javascript environments that favor small modular components over heavy monolithic bundled libraries.","archived":false,"fork":false,"pushed_at":"2020-03-03T20:11:55.000Z","size":126,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-24T18:48:01.007Z","etag":null,"topics":["animation","animation-library","ease","eases","easing-functions","tween","tweening"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ryanhefner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-12T12:05:30.000Z","updated_at":"2024-10-21T09:11:46.000Z","dependencies_parsed_at":"2023-01-26T23:15:28.754Z","dependency_job_id":null,"html_url":"https://github.com/ryanhefner/tweenkle","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Ftweenkle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Ftweenkle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Ftweenkle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Ftweenkle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanhefner","download_url":"https://codeload.github.com/ryanhefner/tweenkle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241290233,"owners_count":19939239,"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","ease","eases","easing-functions","tween","tweening"],"created_at":"2024-10-01T15:35:45.525Z","updated_at":"2025-03-01T00:32:31.093Z","avatar_url":"https://github.com/ryanhefner.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tweenkle ✨\n\nLightweight tweening library built for modern Javascript environments that favor\nsmall modular components over heavy monolithic bundled libraries.\n\nIn addition to the `Tween` class, this library contains\nall of the [Robert Penner easing equations](http://robertpenner.com/easing/) as\ndirect exports for each variation, allowing you to use them in your site or app,\nwithout all the overhead of having to load the entire library. More information\non the available [eases](#eases) is available below.\n\n## Why?\n\nMight as well get this out of the way early, since I’m sure a lot of people will\nsay, \"Why the f@€k did you bother to write another tweening library, THERE ARE\nSO MANY!!!!1!!1!\". Well, you’re right, I didn't have to write this, and there are\nplenty of options out there, but this is part a personal exercise, while also\nbeing the library that I need 90% of the time and is setup to work nicely in ES6\nenvironments.\n\n## Install\n\nVia [npm](https://npmjs.com/package/tweenkle)\n\n```sh\nnpm install --save tweenkle\n```\n\nVia [Yarn](https://yarn.fyi/tweenkle)\n\n```sh\nyarn add tweenkle\n```\n\n### Requirements\n\nBeing that this library is targeted towards modern environments, it assumes that\nthe browsers running this code support `requestAnimationFrame`. If you need to\nsupport browsers that don’t support that, be sure to include a polyfill so that\nthis will work in those browsers.\n\n## How to use\n\n### `Tween`\n\n#### Parameters\n\n* `start` - Initial value you would like to tween from.\n\n* `end` - Target value to tween to. Once reached, the tween completes.\n\n* `duration:Number` - How long the tween will run for in milliseconds. (Default: `1000`)\n\n* `ease:Function` - Easing function/equation used to manipulate the value while tweening. (Default: `Linear`)\n\n* `delay:Number` - _Currently not implemented, but exploring how this could be used._ (Default: `0`)\n\n#### Properties\n\n* `active:Boolean` - Whether or not the instance is tweening.\n\n* `complete:Boolean` - Whether or not the tween has completed.\n\n#### Methods\n\n* `start()` - Start the tween.\n\n* `stop()` - Stop the tween.\n\n#### Events\n\n* `tick` - Fired while the Tween is tweening.\n\n* `complete` - Fired when the tween completes.\n\n#### Example\n\n```js\nimport Tween, { Easing } from 'tweenkle';\n\nconst tween = new Tween({\n    start: 0,\n    end: 100,\n    duration: 1000,\n    ease: Easing.Quad.InOut,\n  });\n\ntween.on('tick', ({start, end, duration, progress, ease, value}) =\u003e {\n  // Manipulate element or variable based on tween value\n});\n\ntween.on('complete', ({start, end, duration, progress, ease, value}) =\u003e {\n  // Tween is done, do whatever you want here, or not. Events are optional.\n});\n\ntween.start();\n```\n\n### Easing\n\nFor the visual people out there, I wrote a quick [easing visualizer](https://codepen.io/ryanhefner/details/YxmKQG/)\nso you can preview what the easing equation looks like before you use it.\n\n* `Back`\n  * `Back.In`\n  * `Back.Out`\n  * `Back.InOut`\n\n* `Bounce`\n  * `Bounce.In`\n  * `Bounce.Out`\n  * `Bounce.InOut`\n\n* `Circ`\n  * `Circ.In`\n  * `Circ.Out`\n  * `Circ.InOut`\n\n* `Cubic`\n  * `Cubic.In`\n  * `Cubic.Out`\n  * `Cubic.InOut`\n\n* `Elastic`\n  * `Elastic.In`\n  * `Elastic.Out`\n  * `Elastic.InOut`\n\n* `Linear`\n\n* `Quad`\n  * `Quad.In`\n  * `Quad.Out`\n  * `Quad.InOut`\n\n* `Quart`\n  * `Quart.In`\n  * `Quart.Out`\n  * `Quart.InOut`\n\n* `Quint`\n  * `Quint.In`\n  * `Quint.Out`\n  * `Quint.InOut`\n\n* `Sine`\n  * `Sine.In`\n  * `Sine.Out`\n  * `Sine.InOut`\n\n## License\n\n[MIT](LICENSE) © [Ryan Hefner](https://www.ryanhefner.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanhefner%2Ftweenkle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanhefner%2Ftweenkle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanhefner%2Ftweenkle/lists"}