Skip to content

Commit 2dcc567

Browse files
committed
Tweens added to a Timeline use that for the timescale
1 parent 9d6f7bc commit 2dcc567

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

v3/src/tween/timeline/Timeline.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ var Timeline = new Class({
1010
{
1111
this.manager = manager;
1212

13+
this.isTimeline = true;
14+
1315
// An array of Tween objects, each containing a unique property and target being tweened.
1416
this.data = [];
1517

v3/src/tween/tween/Tween.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ var Tween = new Class({
55

66
initialize:
77

8-
function Tween (manager, data)
8+
function Tween (parent, data)
99
{
10-
this.manager = manager;
10+
this.parent = parent;
1111

12-
// If the Tween is part of a timeline this tells us which one
13-
this.timeline = null;
12+
// Is the parent of this Tween a Timeline?
13+
this.parentIsTimeline = parent.hasOwnProperty('isTimeline');
1414

1515
// An array of TweenData objects, each containing a unique property and target being tweened.
1616
this.data = data;

v3/src/tween/tween/components/Init.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ var Init = function ()
2424
this.progress = 0;
2525
this.totalProgress = 0;
2626

27-
// console.log('Tween duration', this.duration, 'totalDuration', this.totalDuration);
28-
2927
// You can't have a paused Tween if it's part of a Timeline
30-
if (this.paused && !this.timeline)
28+
if (this.paused && !this.parentIsTimeline)
3129
{
3230
this.state = TWEEN_CONST.PAUSED;
3331

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var Play = function (resetFromTimeline)
77
return;
88
}
99

10-
if (this.timeline)
10+
if (this.parentIsTimeline)
1111
{
1212
this.resetTweenData(resetFromTimeline);
1313

@@ -26,7 +26,7 @@ var Play = function (resetFromTimeline)
2626
{
2727
this.paused = false;
2828

29-
this.manager.makeActive(this);
29+
this.parent.makeActive(this);
3030

3131
return;
3232
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var Update = function (timestamp, delta)
1212

1313
if (this.useFrames)
1414
{
15-
delta = 1 * this.manager.timeScale;
15+
delta = 1 * this.parent.timeScale;
1616
}
1717

1818
delta *= this.timeScale;

0 commit comments

Comments
 (0)