Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

bluecatengineering/nano-spring

Repository files navigation

@bluecateng/nano-spring GitHub license npm version CircleCI

Tiny implementation of spring animation with mass set to 1.

Size: 290 bytes before compression.

⚠️ Notice: the contents of this repository are now part of the Pelagos monorepo, this repository is now archived.

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

About

Tiny implementation of spring animation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published