Skip to content

Commit 3c62cb3

Browse files
committed
Configure timeline without tweens
1 parent 000beb2 commit 3c62cb3

1 file changed

Lines changed: 44 additions & 42 deletions

File tree

src/tweens/builders/TimelineBuilder.js

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,48 +31,6 @@ var TimelineBuilder = function (manager, config)
3131
{
3232
var timeline = new Timeline(manager);
3333

34-
var tweens = GetTweens(config);
35-
36-
if (tweens.length === 0)
37-
{
38-
timeline.paused = true;
39-
40-
return timeline;
41-
}
42-
43-
var defaults = Clone(Defaults);
44-
45-
defaults.targets = GetTargets(config);
46-
47-
// totalDuration: If specified each tween in the Timeline is given an equal portion of the totalDuration
48-
49-
var totalDuration = GetAdvancedValue(config, 'totalDuration', 0);
50-
51-
if (totalDuration > 0)
52-
{
53-
defaults.duration = Math.floor(totalDuration / tweens.length);
54-
}
55-
else
56-
{
57-
defaults.duration = GetNewValue(config, 'duration', defaults.duration);
58-
}
59-
60-
defaults.delay = GetNewValue(config, 'delay', defaults.delay);
61-
defaults.easeParams = GetValue(config, 'easeParams', defaults.easeParams);
62-
defaults.ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), defaults.easeParams);
63-
defaults.hold = GetNewValue(config, 'hold', defaults.hold);
64-
defaults.repeat = GetNewValue(config, 'repeat', defaults.repeat);
65-
defaults.repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay);
66-
defaults.yoyo = GetBoolean(config, 'yoyo', defaults.yoyo);
67-
defaults.flipX = GetBoolean(config, 'flipX', defaults.flipX);
68-
defaults.flipY = GetBoolean(config, 'flipY', defaults.flipY);
69-
70-
// Create the Tweens
71-
for (var i = 0; i < tweens.length; i++)
72-
{
73-
timeline.queue(TweenBuilder(timeline, tweens[i], defaults));
74-
}
75-
7634
timeline.completeDelay = GetAdvancedValue(config, 'completeDelay', 0);
7735
timeline.loop = Math.round(GetAdvancedValue(config, 'loop', 0));
7836
timeline.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0));
@@ -140,6 +98,50 @@ var TimelineBuilder = function (manager, config)
14098
timeline.setCallback('onComplete', onComplete, timelineArray.concat(onCompleteParams), onCompleteScope);
14199
}
142100

101+
// Tweens
102+
103+
var tweens = GetTweens(config);
104+
105+
if (tweens.length === 0)
106+
{
107+
timeline.paused = true;
108+
109+
return timeline;
110+
}
111+
112+
var defaults = Clone(Defaults);
113+
114+
defaults.targets = GetTargets(config);
115+
116+
// totalDuration: If specified each tween in the Timeline is given an equal portion of the totalDuration
117+
118+
var totalDuration = GetAdvancedValue(config, 'totalDuration', 0);
119+
120+
if (totalDuration > 0)
121+
{
122+
defaults.duration = Math.floor(totalDuration / tweens.length);
123+
}
124+
else
125+
{
126+
defaults.duration = GetNewValue(config, 'duration', defaults.duration);
127+
}
128+
129+
defaults.delay = GetNewValue(config, 'delay', defaults.delay);
130+
defaults.easeParams = GetValue(config, 'easeParams', defaults.easeParams);
131+
defaults.ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), defaults.easeParams);
132+
defaults.hold = GetNewValue(config, 'hold', defaults.hold);
133+
defaults.repeat = GetNewValue(config, 'repeat', defaults.repeat);
134+
defaults.repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay);
135+
defaults.yoyo = GetBoolean(config, 'yoyo', defaults.yoyo);
136+
defaults.flipX = GetBoolean(config, 'flipX', defaults.flipX);
137+
defaults.flipY = GetBoolean(config, 'flipY', defaults.flipY);
138+
139+
// Create the Tweens
140+
for (var i = 0; i < tweens.length; i++)
141+
{
142+
timeline.queue(TweenBuilder(timeline, tweens[i], defaults));
143+
}
144+
143145
return timeline;
144146
};
145147

0 commit comments

Comments
 (0)