mini-tween
v1.0.1
Published
Minimal tweening engine.
Downloads
3
Readme
mini-tween
mini-tween is a minimal tweening engine.
Usage
Grab an easing function from jQuery Easing plugin such as easeOutElastic
:
const c4 = (2 * Math.PI) / 3
function easeOutElastic (x) {
return x === 0 ? 0 : x === 1 ? 1 :
Math.pow(2, -10 * x) * Math.sin((x * 10 - 0.75) * c4) + 1
}
Then use it! Online demo
const tween = require('mini-tween')
const div = document.getElementsByTagName('div')[0]
tween(100, 600, 2000, easeOutElastic, height => div.style.height = height + 'px')
.then(() => console.log('end'))
License
MIT