Skip to content

Commit 1de0242

Browse files
committed
Timeline onStarts fire when offset expires.
1 parent 6fe38a1 commit 1de0242

2 files changed

Lines changed: 33 additions & 7 deletions

File tree

v3/src/tween/tween/components/Play.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,22 @@ var Play = function (resetFromTimeline)
66
{
77
return;
88
}
9+
10+
var onStart = this.callbacks.onStart;
911

1012
if (this.parentIsTimeline)
1113
{
1214
this.resetTweenData(resetFromTimeline);
1315

1416
if (this.calculatedOffset === 0)
1517
{
18+
if (onStart)
19+
{
20+
onStart.params[1] = this.targets;
21+
22+
onStart.func.apply(onStart.scope, onStart.params);
23+
}
24+
1625
this.state = TWEEN_CONST.ACTIVE;
1726
}
1827
else
@@ -35,15 +44,13 @@ var Play = function (resetFromTimeline)
3544
this.resetTweenData(false);
3645

3746
this.state = TWEEN_CONST.ACTIVE;
38-
}
3947

40-
var onStart = this.callbacks.onStart;
41-
42-
if (onStart)
43-
{
44-
onStart.params[1] = this.targets;
48+
if (onStart)
49+
{
50+
onStart.params[1] = this.targets;
4551

46-
onStart.func.apply(onStart.scope, onStart.params);
52+
onStart.func.apply(onStart.scope, onStart.params);
53+
}
4754
}
4855
};
4956

v3/src/tween/tween/components/Update.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,31 @@ var Update = function (timestamp, delta)
4646
break;
4747

4848
case TWEEN_CONST.LOOP_DELAY:
49+
50+
this.countdown -= delta;
51+
52+
if (this.countdown <= 0)
53+
{
54+
this.state = TWEEN_CONST.ACTIVE;
55+
}
56+
57+
break;
58+
4959
case TWEEN_CONST.OFFSET_DELAY:
5060

5161
this.countdown -= delta;
5262

5363
if (this.countdown <= 0)
5464
{
65+
var onStart = this.callbacks.onStart;
66+
67+
if (onStart)
68+
{
69+
onStart.params[1] = this.targets;
70+
71+
onStart.func.apply(onStart.scope, onStart.params);
72+
}
73+
5574
this.state = TWEEN_CONST.ACTIVE;
5675
}
5776

0 commit comments

Comments
 (0)