@bluecateng/nano-spring
v2.1.0
Published
Tiny implementation of spring animation
Downloads
1,789
Readme
@bluecateng/nano-spring
Tiny implementation of spring animation with mass set to 1.
Size: 290 bytes before compression.
Installation
npm i -S @bluecateng/nano-spring
Example
import spring from '@bluecateng/nano-spring';
const element = document.querySelector('#test');
element.style.opacity = 0.5;
spring(
250,
30,
(p) => (element.style.transform = `translateX(${p * 300}px)`),
() => (element.style.opacity = '')
);