Timeline onStarts fire when offset expires.

This commit is contained in:
Richard Davey 2017-09-07 15:40:57 +01:00
parent 6fe38a1c51
commit 1de0242fc7
2 changed files with 33 additions and 7 deletions

View file

@ -6,6 +6,8 @@ var Play = function (resetFromTimeline)
{
return;
}
var onStart = this.callbacks.onStart;
if (this.parentIsTimeline)
{
@ -13,6 +15,13 @@ var Play = function (resetFromTimeline)
if (this.calculatedOffset === 0)
{
if (onStart)
{
onStart.params[1] = this.targets;
onStart.func.apply(onStart.scope, onStart.params);
}
this.state = TWEEN_CONST.ACTIVE;
}
else
@ -35,15 +44,13 @@ var Play = function (resetFromTimeline)
this.resetTweenData(false);
this.state = TWEEN_CONST.ACTIVE;
}
var onStart = this.callbacks.onStart;
if (onStart)
{
onStart.params[1] = this.targets;
if (onStart)
{
onStart.params[1] = this.targets;
onStart.func.apply(onStart.scope, onStart.params);
onStart.func.apply(onStart.scope, onStart.params);
}
}
};

View file

@ -46,12 +46,31 @@ var Update = function (timestamp, delta)
break;
case TWEEN_CONST.LOOP_DELAY:
this.countdown -= delta;
if (this.countdown <= 0)
{
this.state = TWEEN_CONST.ACTIVE;
}
break;
case TWEEN_CONST.OFFSET_DELAY:
this.countdown -= delta;
if (this.countdown <= 0)
{
var onStart = this.callbacks.onStart;
if (onStart)
{
onStart.params[1] = this.targets;
onStart.func.apply(onStart.scope, onStart.params);
}
this.state = TWEEN_CONST.ACTIVE;
}