Animator
A mini (1.6kb compressed and 1.1kb gziped!) high-performance animation library.
Provide promise-based API.
Installation
In a browser:
API
class Animator(duration, progress, easing)
Create an animation with duration
millisecond.
var a1 = 1000 { var tx = 100 * p; blockstyletransform = 'translateX(' + tx + 'px)'; }; var a2 = 1000 { var ty = 100 * p; blockstyletransform = 'translate(100px,' + ty + 'px)'; }; var a3 = 1000 { var tx = 100 * 1-p; blockstyletransform = 'translate(' + tx + 'px, 100px)'; }; var a4 = 1000 { var ty = 100 * 1-p; blockstyletransform = 'translateY(' + ty + 'px)'; }; block;
animate()
Start the animation and return a promise.
ease(easing)
Return a new animation with a new easing.
var easeInOutBack = ;//easeInOutBack var a1 = 2000 { var x = 200 * ep; blockstyletransform = 'translateX(' + x + 'px)';} easeInOutBack; var a2 = a1; //reverse a1 block;
cancel()
Cancel the animation and reject the promise.
Develop & Build
Download the codebase and run:
npm install
You can start a sever through:
npm start
Build and deploy the JS file:
npm run build
License
MIT