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

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

View file

@ -46,12 +46,31 @@ var Update = function (timestamp, delta)
break; break;
case TWEEN_CONST.LOOP_DELAY: case TWEEN_CONST.LOOP_DELAY:
this.countdown -= delta;
if (this.countdown <= 0)
{
this.state = TWEEN_CONST.ACTIVE;
}
break;
case TWEEN_CONST.OFFSET_DELAY: case TWEEN_CONST.OFFSET_DELAY:
this.countdown -= delta; this.countdown -= delta;
if (this.countdown <= 0) 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; this.state = TWEEN_CONST.ACTIVE;
} }