raf-tweener
An extremely minimal tweening engine based on GSAP, powered by requestAnimationFrame.
var rafTweener = require('raf-tweener');
var eases = require('eases');
var target = {
x: 0,
y: 0
};
rafTweener.start();
rafTweener.to(
target, //tween target object
10, //duration
{
x: 100, //value to tween
y: 50, //value to tween
ease: eases.expoInOut, //an easing method takes in a value 0..1 and returns a value 0..1
onUpdate: function() {
console.log(this.x.toFixed(2), this.y.toFixed(2));
},
onUpdateScope: target,
onComplete: function() {
console.log('done!');
}
}
);
Usage
License
MIT, see LICENSE.md for details.