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).

    Install

    npm i anim

    DownloadsWeekly Downloads

    0

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • vweevers