Skip to content

Commit 26591ce

Browse files
committed
Added completeDelay and elasticity (not yet hooked up)
1 parent e2c08dd commit 26591ce

3 files changed

Lines changed: 21 additions & 18 deletions

File tree

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '48abf510-3ab5-11e7-94f8-f16a04e0b1e8'
2+
build: '3f2f3a70-3ab9-11e7-9be9-3f1f4f292edc'
33
};
44
module.exports = CHECKSUM;

v3/src/tween/Tween.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ var Tween = function (manager, target, key, value)
1313
this.current;
1414
this.end;
1515

16-
this.ease;
17-
this.duration = 1000;
18-
this.yoyo = false;
19-
this.repeat = 0;
20-
this.loop = false;
21-
this.delay = 0;
22-
this.repeatDelay = 0;
23-
this.onCompleteDelay = 0;
16+
this.ease; // the ease function this tween uses
17+
this.duration = 1000; // duration of the tween in ms/frames, excludes time for yoyo or repeats
18+
this.yoyo = false; // alternate the tween back to its start position again?
19+
this.repeat = 0; // number of times to repeat the tween (-1 = forever, same as setting loop=true)
20+
this.loop = false; // infinitely loop this tween?
21+
this.delay = 0; // time in ms/frames between tween will start its first run
22+
this.repeatDelay = 0; // time in ms/frames before repeat will start
23+
this.onCompleteDelay = 0; // time in ms/frames before the 'onComplete' event fires
2424
this.elasticity = 0;
2525

2626
// Changes the property to be this before starting the tween
2727
this.startAt;
2828

29-
this.progress = 0;
30-
this.elapsed = 0;
31-
this.countdown = 0;
29+
this.progress = 0; // between 0 and 1 showing completion of current portion of tween
30+
this.elapsed = 0; // delta counter
31+
this.countdown = 0; // delta countdown timer
3232

33-
this.repeatCounter = 0;
33+
this.repeatCounter = 0; // how many repeats are left to run?
3434

3535
// 0 = Waiting to be added to the TweenManager
3636
// 1 = Paused (dev needs to invoke Tween.start)
@@ -141,7 +141,7 @@ Tween.prototype = {
141141

142142
var progress = elapsed / duration;
143143

144-
var p = this.ease(progress);
144+
var p = this.ease(progress, 0.1, this.elasticity);
145145

146146
// Optimize
147147
this.current = this.start + ((this.end - this.start) * p);
@@ -174,7 +174,7 @@ Tween.prototype = {
174174

175175
var progress = elapsed / duration;
176176

177-
var p = this.ease(1 - progress);
177+
var p = this.ease(1 - progress, 0.1, this.elasticity);
178178

179179
// Optimize
180180
this.current = this.start + ((this.end - this.start) * p);

v3/src/tween/TweenBuilder.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,10 @@ var TweenBuilder = function (manager, config)
151151
var yoyo = GetValue(config, 'yoyo', false);
152152
var repeat = GetAdvancedValue(config, 'repeat', 0);
153153
var repeatDelay = GetAdvancedValue(config, 'repeatDelay', 0);
154+
var completeDelay = GetAdvancedValue(config, 'completeDelay', 0);
154155
var loop = GetValue(config, 'loop', false);
155156
var delay = GetAdvancedValue(config, 'delay', 0);
156-
157-
// var onCompleteDelay = 0;
158-
// var elasticity = 0;
157+
var elasticity = GetAdvancedValue(config, 'elasticity', 0);
159158

160159
for (var p = 0; p < props.length; p++)
161160
{
@@ -168,8 +167,10 @@ var TweenBuilder = function (manager, config)
168167
var iYoyo = GetValue(value, 'yoyo', yoyo);
169168
var iRepeat = GetAdvancedValue(value, 'repeat', repeat);
170169
var iRepeatDelay = GetAdvancedValue(value, 'repeatDelay', repeatDelay);
170+
var iCompleteDelay = GetAdvancedValue(value, 'completeDelay', completeDelay);
171171
var iLoop = GetValue(value, 'loop', loop);
172172
var iDelay = GetAdvancedValue(value, 'delay', delay);
173+
var iElasticity = GetAdvancedValue(value, 'elasticity', elasticity);
173174

174175
for (var t = 0; t < targets.length; t++)
175176
{
@@ -184,8 +185,10 @@ var TweenBuilder = function (manager, config)
184185
tween.yoyo = iYoyo;
185186
tween.repeat = iRepeat;
186187
tween.repeatDelay = iRepeatDelay;
188+
tween.completeDelay = iCompleteDelay;
187189
tween.loop = iLoop;
188190
tween.delay = iDelay;
191+
tween.elasticity = iElasticity;
189192

190193
tweens.push(tween);
191194

0 commit comments

Comments
 (0)