vanilla-spring
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

vanilla-spring

Use keyframes run spring animation.

Tiny, gzip: 0.4kb, run every(Vanilla, React, Vue...) project.

Thank Project: Springer

Install

$ npm install --save vanilla-spring

or

<script src="https://unpkg.com/vanilla-spring@1.0.0/umd/index.js"></script>

Only a function

import vanillaSpring from 'vanilla-spring';

vanillaSpring({
  name:'move',
  makeReverse: true,
  keyframe: v=> `
    transform: translateX(${100 * v}px);
    opacity: ${v};
  `,
})


const view = document.getElementById('view');
view.style.animation = 'move 1s';

// move back and keep end
setTimeout(funciont(){
  view.style.animation = 'move-reverse 1s';
  view.style.animationFillMode ='forwards';
}, 2000);

Readme

Keywords

none

Package Sidebar

Install

npm i vanilla-spring

Weekly Downloads

7

Version

1.0.1

License

none

Unpacked Size

11.6 kB

Total Files

13

Last publish

Collaborators

  • ymblender