@bluecateng/nano-spring
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

@bluecateng/nano-spring GitHub license npm version

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 = '')
);

Output

Output

Readme

Keywords

Package Sidebar

Install

npm i @bluecateng/nano-spring

Weekly Downloads

526

Version

2.1.0

License

ISC

Unpacked Size

3.06 kB

Total Files

5

Last publish

Collaborators

  • jcestibariz
  • chinanwu