Wizcorp / tina.js

Tweening and INterpolations for Animation
MIT License
12 stars 8 forks source link

Tina doesn't update when a Ticker is set as default tweener #45

Closed cstoquer closed 8 years ago

cstoquer commented 8 years ago

tested with the following code taken form readme:

var ticker = new TINA.Ticker().useAsDefault();
TINA.add(ticker );

function update() {
    TINA.update();
    mainLoop();
    requestAnimationFrame(update);
}
requestAnimationFrame(update);

and the following tween in my mainLoop:

var duration = 100;
var bouncing = 4;
var particle = {
    x: 0,
    y: 0,
    draw: function () {
        sprite(14, this.x, this.y);
    }
}

TINA.Tween(particle, ['x'])
    .from({ x:   0 })
    .to({   x: 120 }, duration)
    .iterations(Infinity) // loop forever
    .start();

the particle doesn't move as expected. But it will if I use a Timer instead of a Ticker for TINA default tweener.