A simple but powerful tweening engine for Javascript.
npm i b-tween
import BTween from 'b-tween';
const tween = new BTween({
from: {
left: 0
},
to: {
left: 700
},
duration: 500,
easing: 'bounceOut',
onUpdate: (keys) => {
// You can do everything with keys
block.style.left = keys.left + 'px';
}
});
tween.start();
const BTween = require('b-tween');
...
https://unpkg.com/b-tween/dist/b-tween.umd.js
<script src="https://unpkg.com/b-tween/dist/b-tween.umd.js"></script>
<script>
const tween = new BTween({
...
});
tween.start();
</script>
- linear
- quadIn
- quadOut
- quadInOut
- cubicIn
- cubicOut
- cubicInOut
- quartIn
- quartOut
- quartInOut
- quintIn
- quintOut
- quintInOut
- sineIn
- sineOut
- sineInOut
- bounceIn
- bounceOut
- bounceInOut
const tween = new Btween({...});
tween.start();