anim

0.0.1 • Public • Published

anim

Animate a property from current to specified value, with requestAnimationFrame and easing.

example

// Fake scroll
anim(element.style, 'marginTop', -100, {
  px: true, 
  duration: 600,
  ease: 'outSine'
})

api

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

install

With npm do:

npm install anim

license

MIT

credits

Adapted from scroll by Michael Rhodes (license: MIT).

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i anim

    Weekly Downloads

    5

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • vweevers