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);
if (!timeline.paused)
{
this._add.push(timeline);
this._toProcess++;
}
return timeline;
},

View file

@ -102,6 +102,8 @@ var Timeline = new Class({
},
queue: function (tween)
{
if (!this.isPlaying())
{
tween.parent = this;
tween.parentIsTimeline = true;
@ -109,6 +111,7 @@ var Timeline = new Class({
this.data.push(tween);
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();
}
}
});