inrtia
v0.2.3
Published
☄️ lightweight inertia based animation library
Downloads
119
Maintainers
Readme
☄️ inrtia.js
lightweight (3kB not gzipped) inertia based animation library
Demo
https://jonasfolletete.github.io/inrtia/
Examples
Basic Usage
import Inrtia from 'inrtia';
var inrtia = new Inrtia({
value : 0,
interpolation : 'basic'
});
inrtia.to(20);
raf();
function raf() {
if (!inrtia.stopped) {
const value = inrtia.update();
div.style.left = value + 'px'
// ... Do stuff with inrtia.value
}
window.requestAnimationFrame(raf);
}
Object Usage
var inrtia = new Inrtia({
value : {x: 0, y: 0}
});
inrtia.to({x: 10, y: 20});
Array Usage
var inrtia = new Inrtia({
value : [0, 0, 0]
});
inrtia.to([10, 20, 30]);