1.0.0 • Published 2 years ago

myntra-twain v1.0.0

Weekly downloads
-
License
BSD
Repository
-
Last release
2 years ago

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