An open API service indexing awesome lists of open source software.

https://github.com/ymzuiku/vanilla-spring

Use keyframes run spring
https://github.com/ymzuiku/vanilla-spring

Last synced: about 2 months ago
JSON representation

Use keyframes run spring

Awesome Lists containing this project

README

        

# vanilla-spring

Use keyframes run spring animation.

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

Thank Project: Springer

## Install

```sh
$ npm install --save vanilla-spring
```

or

```js

```

## Only a function

```js
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);
```