myntra-twain

1.0.0 • Public • Published

twain

dynamic tweening engine using exponential smoothing

Build Status

Installation

$ component install threepointone/twain

API

from examples/basic.html

var box = document.getElementById('box'),
    tween = Twain();    // start up a new tweener


tween.update(function(step) {
    // step.left, step.top have values to be set
    for(var prop in step){
        box.style[prop] = step[prop] + 'px';
    }

    // or if you had jquery, you could do -
    // $(box).css(step);

});

// update targets with every mousemove
document.body.addEventListener('mousemove', function(e) {
    tween.to({
        left: e.clientX,
        top:  e.clientY
    });
});

setInterval(function(){
    tween.update();
}, 1000/60)

Tests

Install dependencies with

npm install

then run

npm test

Coverage

npm run-script coverage

License

MIT

bits and pieces from

/myntra-twain/

    Package Sidebar

    Install

    npm i myntra-twain

    Weekly Downloads

    2

    Version

    1.0.0

    License

    BSD

    Unpacked Size

    32.3 kB

    Total Files

    18

    Last publish

    Collaborators

    • shibasis0801