femtoTween
femtoTween's goal is to provide just enough tweening functionality to cover basic use cases. Through this primary goal, it should also be one of the smallest tweening libraries (less than 1k un-minified even).
yarn add femtotween
import { tween } from 'femtotween'
Very few features
- Minimal API can be grok'd in seconds
- Supports a
done
callback - especially useful for Vue.js transitions via JS hooks - Supports and provides additional easing functions
Example
State transition example from the Vue.js docs, there's also an example of enter/leave transitions.
{{ animatedNumber }}
API
tween(from, to, callback, options)
from
value to tween from
to
value to tween to
callback
callback function that will be called on each tween-frame
options
done
: callback function called when tweening is doneeaseFunc
: function used for easing - default:easeInOutQuart
time
: time in ms for the tween - default:400
return value
() => void
- a 'stop' function to stop tweening