mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 14:08:28 +00:00
Added Tween.restart and stopped the manager adding the same tween twice
This commit is contained in:
parent
a2d96f52e4
commit
206f6b1271
3 changed files with 15 additions and 1 deletions
|
@ -160,6 +160,11 @@ var TweenManager = new Class({
|
|||
|
||||
makeActive: function (tween)
|
||||
{
|
||||
if (this._add.indexOf(tween) !== -1 || this._active.indexOf(tween) !== -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var idx = this._pending.indexOf(tween);
|
||||
|
||||
if (idx !== -1)
|
||||
|
@ -172,6 +177,8 @@ var TweenManager = new Class({
|
|||
tween.state = TWEEN_CONST.PENDING_ADD;
|
||||
|
||||
this._toProcess++;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
setGlobalTimeScale: require('./components/SetGlobalTimeScale'),
|
||||
|
|
|
@ -131,6 +131,12 @@ var Tween = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
restart: function ()
|
||||
{
|
||||
this.stop();
|
||||
this.play();
|
||||
},
|
||||
|
||||
calcDuration: require('./components/CalcDuration'),
|
||||
init: require('./components/Init'),
|
||||
nextState: require('./components/NextState'),
|
||||
|
|
|
@ -10,6 +10,7 @@ var Play = function (resetFromTimeline)
|
|||
{
|
||||
this.init();
|
||||
this.parent.makeActive(this);
|
||||
resetFromTimeline = true;
|
||||
}
|
||||
|
||||
var onStart = this.callbacks.onStart;
|
||||
|
@ -46,7 +47,7 @@ var Play = function (resetFromTimeline)
|
|||
}
|
||||
else
|
||||
{
|
||||
this.resetTweenData(false);
|
||||
this.resetTweenData(resetFromTimeline);
|
||||
|
||||
this.state = TWEEN_CONST.ACTIVE;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue