Skip to content

myntra/twain

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

dynamic tweening engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 95.5%
  • Makefile 4.5%