Added hasTarget method. Also you cannot add a Tween into a Timeline already playing.

This commit is contained in:
Richard Davey 2017-09-07 16:52:57 +01:00
parent 1de0242fc7
commit fb8b428f64
2 changed files with 26 additions and 8 deletions

View file

@ -39,9 +39,12 @@ var TweenManager = new Class({
{
var timeline = TimelineBuilder(this, config);
this._add.push(timeline);
if (!timeline.paused)
{
this._add.push(timeline);
this._toProcess++;
this._toProcess++;
}
return timeline;
},

View file

@ -103,12 +103,15 @@ var Timeline = new Class({
queue: function (tween)
{
tween.parent = this;
tween.parentIsTimeline = true;
if (!this.isPlaying())
{
tween.parent = this;
tween.parentIsTimeline = true;
this.data.push(tween);
this.data.push(tween);
this.totalData = this.data.length;
this.totalData = this.data.length;
}
return this;
},
@ -467,13 +470,25 @@ var Timeline = new Class({
return this;
},
hasTarget: function ()
hasTarget: function (target)
{
for (var i = 0; i < this.data.length; i++)
{
if (this.data[i].hasTarget(target))
{
return true;
}
}
return false;
},
destroy: function ()
{
for (var i = 0; i < this.data.length; i++)
{
this.data[i].destroy();
}
}
});