only start animator if assets are ready

This commit is contained in:
Francisco Dans 2015-01-05 16:54:14 +01:00
parent c21c715bf4
commit 5dc39a5e32

View File

@ -27,6 +27,7 @@ var cancelAnimationFrame = global.cancelAnimationFrame
this._t0 = +new Date(); this._t0 = +new Date();
this.callback = callback; this.callback = callback;
this._time = 0.0; this._time = 0.0;
this.itemsReady = false;
this.options = torque.extend({ this.options = torque.extend({
animationDelay: 0, animationDelay: 0,
@ -42,9 +43,11 @@ var cancelAnimationFrame = global.cancelAnimationFrame
Animator.prototype = { Animator.prototype = {
start: function() { start: function() {
this.running = true; if(this.itemsReady){
requestAnimationFrame(this._tick); this.running = true;
this.options.onStart && this.options.onStart(); requestAnimationFrame(this._tick);
this.options.onStart && this.options.onStart();
}
}, },
isRunning: function() { isRunning: function() {