Animate a property from current to specified value
npm install anim>Animate a property from current to specified value, with requestAnimationFrame and easing.
``js`
// Fake scroll
anim(element.style, 'marginTop', -100, {
px: true,
duration: 600,
ease: 'outSine'
})
anim(obj, prop, to, opts, cb)
- {object} obj Container object{string} prop
- Property to animate{mixed} to
- Target value{object} opts
- Optional options{Function} cb
- Optional callback
Options are:
- {integer} duration In ms{boolean} px
- Append "px" to value{boolean} round
- Round value{string} ease
- Easing function, e.g. outSine or inOutQuart
With npm do:
```
npm install anim
MIT
Adapted from scroll by Michael Rhodes (license: MIT).