greensock-rails 1.17.0.0 → 1.18.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -3
- data/lib/greensock/rails/version.rb +1 -1
- data/vendor/assets/javascripts/greensock/TimelineLite.js +71 -41
- data/vendor/assets/javascripts/greensock/TimelineMax.js +112 -45
- data/vendor/assets/javascripts/greensock/TweenLite.js +130 -52
- data/vendor/assets/javascripts/greensock/TweenMax.js +436 -213
- data/vendor/assets/javascripts/greensock/jquery.gsap.js +5 -5
- data/vendor/assets/javascripts/greensock/plugins/AttrPlugin.js +5 -41
- data/vendor/assets/javascripts/greensock/plugins/CSSPlugin.js +146 -68
- data/vendor/assets/javascripts/greensock/plugins/ColorPropsPlugin.js +168 -70
- data/vendor/assets/javascripts/greensock/plugins/RoundPropsPlugin.js +28 -16
- data/vendor/assets/javascripts/greensock/utils/Draggable.js +42 -26
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c456688b993cc47f4ec0bcd2042d9a87f2c5bee6
|
4
|
+
data.tar.gz: b5a09a732e1bf5bc16fe5be7b79cbf150c07b488
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b119fed0782ee293f61171195ff20bc83ba44657be7d481da91cb55d426f686c701389362f19f43046804db024970da6449c09ec22574abbd6f1991f4140aff5
|
7
|
+
data.tar.gz: 3c228d200aa961bc668d8f2fc118c26bd296b8226ce019a7844dea2c002316aeaa51b94d0febac04e3d27a50d09d9af428a9974a33e4927edf5bbde1f4a26648
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
This is a Ruby gem for adding the great [Greensock JavaScript tweening engine](http://www.greensock.com/gsap-js/) to Rails, so that you can animate the hell out of your RESTful app :)
|
4
4
|
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/greensock-rails.png)](http://badge.fury.io/rb/greensock-rails)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/greensock-rails.png)](http://badge.fury.io/rb/greensock-rails)
|
6
6
|
|
7
7
|
## greensock-rails RubyGems URL
|
8
8
|
|
@@ -45,5 +45,14 @@ Please do not open an issue if there is a bug in GSAP itself. Any bugs of the Gr
|
|
45
45
|
|
46
46
|
## Copyright
|
47
47
|
|
48
|
-
|
49
|
-
|
48
|
+
<a href="https://github.com/greensock/GreenSock-JS" target="_blank">
|
49
|
+
<img width="206" src="https://raw.githubusercontent.com/handcraftedLDN/greensock-rails/master/greensock_logo_64.png" alt="Greensock Logo"/>
|
50
|
+
</a>
|
51
|
+
|
52
|
+
Greensock JS: Copyright (c) 2015, GreenSock. All rights reserved.
|
53
|
+
|
54
|
+
<a href="http://handcrafteddigital.london" target="_blank">
|
55
|
+
<img width="192" src="https://raw.githubusercontent.com/handcraftedLDN/greensock-rails/master/handcrafted-digital-london-logo@2x.png" alt="Handcrafted Digital London - Fine, hand made design and development from London"/>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
Copyright © 2015 The <a href="https://github.com/handcraftedLDN/brewser" target="_blank">greensock-rails</a> gem has been <a href="http://handcrafteddigital.london" target="_blank">Handcrafted</a>.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 1.
|
3
|
-
* DATE: 2015-
|
2
|
+
* VERSION: 1.18.0
|
3
|
+
* DATE: 2015-08-29
|
4
4
|
* UPDATES AND DOCS AT: http://greensock.com
|
5
5
|
*
|
6
6
|
* @license Copyright (c) 2008-2015, GreenSock. All rights reserved.
|
@@ -42,7 +42,6 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
42
42
|
_isArray = TweenLiteInternals.isArray,
|
43
43
|
_lazyTweens = TweenLiteInternals.lazyTweens,
|
44
44
|
_lazyRender = TweenLiteInternals.lazyRender,
|
45
|
-
_blankArray = [],
|
46
45
|
_globals = _gsScope._gsDefine.globals,
|
47
46
|
_copy = function(vars) {
|
48
47
|
var copy = {}, p;
|
@@ -51,35 +50,16 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
51
50
|
}
|
52
51
|
return copy;
|
53
52
|
},
|
54
|
-
|
55
|
-
var
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
prev = reversed ? _tinyNum : 0,
|
61
|
-
sibling;
|
62
|
-
if (callback || !this._forcingPlayhead) { //if the user calls a method that moves the playhead (like progress() or time()), it should honor that and skip any pauses (although if there's a callback positioned at that pause, it must jump there and make the call to ensure the time is EXACTLY what it is supposed to be, and then proceed to where the playhead is being forced). Otherwise, imagine placing a pause in the middle of a timeline and then doing timeline.progress(0.9) - it would get stuck where the pause is.
|
63
|
-
tl.pause(startTime);
|
64
|
-
//now find sibling tweens that are EXACTLY at the same spot on the timeline and adjust the _rawPrevTime so that they fire (or don't fire) correctly on the next render. This is primarily to accommodate zero-duration tweens/callbacks that are positioned right on top of a pause. For example, tl.to(...).call(...).addPause(...).call(...) - notice that there's a call() on each side of the pause, so when it's running forward it should call the first one and then pause, and then when resumed, call the other. Zero-duration tweens use _rawPrevTime to sense momentum figure out if events were suppressed when arriving directly on top of that time.
|
65
|
-
sibling = tween._prev;
|
66
|
-
while (sibling && sibling._startTime === startTime) {
|
67
|
-
sibling._rawPrevTime = prev;
|
68
|
-
sibling = sibling._prev;
|
69
|
-
}
|
70
|
-
sibling = tween._next;
|
71
|
-
while (sibling && sibling._startTime === startTime) {
|
72
|
-
sibling._rawPrevTime = next;
|
73
|
-
sibling = sibling._next;
|
74
|
-
}
|
75
|
-
if (callback) {
|
76
|
-
callback.apply(scope || tl.vars.callbackScope || tl, params || _blankArray);
|
77
|
-
}
|
78
|
-
if (this._forcingPlayhead || !tl._paused) { //the callback could have called resume().
|
79
|
-
tl.seek(time);
|
80
|
-
}
|
53
|
+
_applyCycle = function(vars, targets, i) {
|
54
|
+
var alt = vars.cycle,
|
55
|
+
p, val;
|
56
|
+
for (p in alt) {
|
57
|
+
val = alt[p];
|
58
|
+
vars[p] = (typeof(val) === "function") ? val.call(targets[i], i) : val[i % val.length];
|
81
59
|
}
|
60
|
+
delete vars.cycle;
|
82
61
|
},
|
62
|
+
_pauseCallback = _internals.pauseCallback = function() {},
|
83
63
|
_slice = function(a) { //don't use [].slice because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll()
|
84
64
|
var b = [],
|
85
65
|
l = a.length,
|
@@ -89,9 +69,9 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
89
69
|
},
|
90
70
|
p = TimelineLite.prototype = new SimpleTimeline();
|
91
71
|
|
92
|
-
TimelineLite.version = "1.
|
72
|
+
TimelineLite.version = "1.18.0";
|
93
73
|
p.constructor = TimelineLite;
|
94
|
-
p.kill()._gc = p._forcingPlayhead = false;
|
74
|
+
p.kill()._gc = p._forcingPlayhead = p._hasPause = false;
|
95
75
|
|
96
76
|
/* might use later...
|
97
77
|
//translates a local time inside an animation to the corresponding time on the root/global timeline, factoring in all nesting and timeScales.
|
@@ -131,7 +111,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
131
111
|
|
132
112
|
p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
|
133
113
|
var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, callbackScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
|
134
|
-
|
114
|
+
cycle = vars.cycle,
|
115
|
+
copy, i;
|
135
116
|
if (typeof(targets) === "string") {
|
136
117
|
targets = TweenLite.selector(targets) || targets;
|
137
118
|
}
|
@@ -146,10 +127,17 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
146
127
|
stagger *= -1;
|
147
128
|
}
|
148
129
|
for (i = 0; i < targets.length; i++) {
|
149
|
-
|
150
|
-
|
130
|
+
copy = _copy(vars);
|
131
|
+
if (copy.startAt) {
|
132
|
+
copy.startAt = _copy(copy.startAt);
|
133
|
+
if (copy.startAt.cycle) {
|
134
|
+
_applyCycle(copy.startAt, targets, i);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
if (cycle) {
|
138
|
+
_applyCycle(copy, targets, i);
|
151
139
|
}
|
152
|
-
tl.to(targets[i], duration,
|
140
|
+
tl.to(targets[i], duration, copy, i * stagger);
|
153
141
|
}
|
154
142
|
return this.add(tl, position);
|
155
143
|
};
|
@@ -261,7 +249,10 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
261
249
|
|
262
250
|
p.remove = function(value) {
|
263
251
|
if (value instanceof Animation) {
|
264
|
-
|
252
|
+
this._remove(value, false);
|
253
|
+
var tl = value._timeline = value.vars.useFrames ? Animation._rootFramesTimeline : Animation._rootTimeline; //now that it's removed, default it to the root timeline so that if it gets played again, it doesn't jump back into this timeline.
|
254
|
+
value._startTime = (value._paused ? value._pauseTime : tl._time) - ((!value._reversed ? value._totalTime : value.totalDuration() - value._totalTime) / value._timeScale); //ensure that if it gets played again, the timing is correct.
|
255
|
+
return this;
|
265
256
|
} else if (value instanceof Array || (value && value.push && _isArray(value))) {
|
266
257
|
var i = value.length;
|
267
258
|
while (--i > -1) {
|
@@ -304,8 +295,10 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
304
295
|
};
|
305
296
|
|
306
297
|
p.addPause = function(position, callback, params, scope) {
|
307
|
-
var t = TweenLite.delayedCall(0, _pauseCallback,
|
308
|
-
t.
|
298
|
+
var t = TweenLite.delayedCall(0, _pauseCallback, params, scope || this);
|
299
|
+
t.vars.onComplete = t.vars.onReverseComplete = callback;
|
300
|
+
t.data = "isPause";
|
301
|
+
this._hasPause = true;
|
309
302
|
return this.add(t, position);
|
310
303
|
};
|
311
304
|
|
@@ -376,7 +369,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
376
369
|
prevStart = this._startTime,
|
377
370
|
prevTimeScale = this._timeScale,
|
378
371
|
prevPaused = this._paused,
|
379
|
-
tween, isComplete, next, callback, internalForce;
|
372
|
+
tween, isComplete, next, callback, internalForce, pauseTween;
|
380
373
|
if (time >= totalDur) {
|
381
374
|
this._totalTime = this._time = totalDur;
|
382
375
|
if (!this._reversed) if (!this._hasPausedChild()) {
|
@@ -426,9 +419,34 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
426
419
|
}
|
427
420
|
|
428
421
|
} else {
|
422
|
+
|
423
|
+
if (this._hasPause && !this._forcingPlayhead && !suppressEvents) {
|
424
|
+
if (time >= prevTime) {
|
425
|
+
tween = this._first;
|
426
|
+
while (tween && tween._startTime <= time && !pauseTween) {
|
427
|
+
if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && this._rawPrevTime === 0)) {
|
428
|
+
pauseTween = tween;
|
429
|
+
}
|
430
|
+
tween = tween._next;
|
431
|
+
}
|
432
|
+
} else {
|
433
|
+
tween = this._last;
|
434
|
+
while (tween && tween._startTime >= time && !pauseTween) {
|
435
|
+
if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) {
|
436
|
+
pauseTween = tween;
|
437
|
+
}
|
438
|
+
tween = tween._prev;
|
439
|
+
}
|
440
|
+
}
|
441
|
+
if (pauseTween) {
|
442
|
+
this._time = time = pauseTween._startTime;
|
443
|
+
this._totalTime = time + (this._cycle * (this._totalDuration + this._repeatDelay));
|
444
|
+
}
|
445
|
+
}
|
446
|
+
|
429
447
|
this._totalTime = this._time = this._rawPrevTime = time;
|
430
448
|
}
|
431
|
-
if ((this._time === prevTime || !this._first) && !force && !internalForce) {
|
449
|
+
if ((this._time === prevTime || !this._first) && !force && !internalForce && !pauseTween) {
|
432
450
|
return;
|
433
451
|
} else if (!this._initted) {
|
434
452
|
this._initted = true;
|
@@ -449,6 +467,9 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
449
467
|
if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
|
450
468
|
break;
|
451
469
|
} else if (tween._active || (tween._startTime <= this._time && !tween._paused && !tween._gc)) {
|
470
|
+
if (pauseTween === tween) {
|
471
|
+
this.pause();
|
472
|
+
}
|
452
473
|
if (!tween._reversed) {
|
453
474
|
tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
|
454
475
|
} else {
|
@@ -464,6 +485,15 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
464
485
|
if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
|
465
486
|
break;
|
466
487
|
} else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) {
|
488
|
+
if (pauseTween === tween) {
|
489
|
+
pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse.
|
490
|
+
while (pauseTween && pauseTween.endTime() > this._time) {
|
491
|
+
pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force);
|
492
|
+
pauseTween = pauseTween._prev;
|
493
|
+
}
|
494
|
+
pauseTween = null;
|
495
|
+
this.pause();
|
496
|
+
}
|
467
497
|
if (!tween._reversed) {
|
468
498
|
tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
|
469
499
|
} else {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 1.
|
3
|
-
* DATE: 2015-
|
2
|
+
* VERSION: 1.18.0
|
3
|
+
* DATE: 2015-08-29
|
4
4
|
* UPDATES AND DOCS AT: http://greensock.com
|
5
5
|
*
|
6
6
|
* @license Copyright (c) 2008-2015, GreenSock. All rights reserved.
|
@@ -33,7 +33,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
33
33
|
|
34
34
|
p.constructor = TimelineMax;
|
35
35
|
p.kill()._gc = false;
|
36
|
-
TimelineMax.version = "1.
|
36
|
+
TimelineMax.version = "1.18.0";
|
37
37
|
|
38
38
|
p.invalidate = function() {
|
39
39
|
this._yoyo = (this.vars.yoyo === true);
|
@@ -113,7 +113,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
113
113
|
prevRawPrevTime = this._rawPrevTime,
|
114
114
|
prevPaused = this._paused,
|
115
115
|
prevCycle = this._cycle,
|
116
|
-
tween, isComplete, next, callback, internalForce, cycleDuration;
|
116
|
+
tween, isComplete, next, callback, internalForce, cycleDuration, pauseTween;
|
117
117
|
if (time >= totalDur) {
|
118
118
|
if (!this._locked) {
|
119
119
|
this._totalTime = totalDur;
|
@@ -200,6 +200,32 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
200
200
|
}
|
201
201
|
}
|
202
202
|
}
|
203
|
+
|
204
|
+
if (this._hasPause && !this._forcingPlayhead && !suppressEvents) {
|
205
|
+
time = this._time;
|
206
|
+
if (time >= prevTime) {
|
207
|
+
tween = this._first;
|
208
|
+
while (tween && tween._startTime <= time && !pauseTween) {
|
209
|
+
if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && this._rawPrevTime === 0)) {
|
210
|
+
pauseTween = tween;
|
211
|
+
}
|
212
|
+
tween = tween._next;
|
213
|
+
}
|
214
|
+
} else {
|
215
|
+
tween = this._last;
|
216
|
+
while (tween && tween._startTime >= time && !pauseTween) {
|
217
|
+
if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) {
|
218
|
+
pauseTween = tween;
|
219
|
+
}
|
220
|
+
tween = tween._prev;
|
221
|
+
}
|
222
|
+
}
|
223
|
+
if (pauseTween) {
|
224
|
+
this._time = time = pauseTween._startTime;
|
225
|
+
this._totalTime = time + (this._cycle * (this._totalDuration + this._repeatDelay));
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
203
229
|
}
|
204
230
|
|
205
231
|
if (this._cycle !== prevCycle) if (!this._locked) {
|
@@ -250,7 +276,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
250
276
|
this._rawPrevTime = recRawPrevTime;
|
251
277
|
}
|
252
278
|
|
253
|
-
if ((this._time === prevTime || !this._first) && !force && !internalForce) {
|
279
|
+
if ((this._time === prevTime || !this._first) && !force && !internalForce && !pauseTween) {
|
254
280
|
if (prevTotalTime !== this._totalTime) if (this._onUpdate) if (!suppressEvents) { //so that onUpdate fires even during the repeatDelay - as long as the totalTime changed, we should trigger onUpdate.
|
255
281
|
this._callback("onUpdate");
|
256
282
|
}
|
@@ -274,12 +300,14 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
274
300
|
if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
|
275
301
|
break;
|
276
302
|
} else if (tween._active || (tween._startTime <= this._time && !tween._paused && !tween._gc)) {
|
303
|
+
if (pauseTween === tween) {
|
304
|
+
this.pause();
|
305
|
+
}
|
277
306
|
if (!tween._reversed) {
|
278
307
|
tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
|
279
308
|
} else {
|
280
309
|
tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
|
281
310
|
}
|
282
|
-
|
283
311
|
}
|
284
312
|
tween = next;
|
285
313
|
}
|
@@ -290,6 +318,15 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
290
318
|
if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
|
291
319
|
break;
|
292
320
|
} else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) {
|
321
|
+
if (pauseTween === tween) {
|
322
|
+
pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse.
|
323
|
+
while (pauseTween && pauseTween.endTime() > this._time) {
|
324
|
+
pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force);
|
325
|
+
pauseTween = pauseTween._prev;
|
326
|
+
}
|
327
|
+
pauseTween = null;
|
328
|
+
this.pause();
|
329
|
+
}
|
293
330
|
if (!tween._reversed) {
|
294
331
|
tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
|
295
332
|
} else {
|
@@ -505,7 +542,6 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
505
542
|
_isArray = TweenLiteInternals.isArray,
|
506
543
|
_lazyTweens = TweenLiteInternals.lazyTweens,
|
507
544
|
_lazyRender = TweenLiteInternals.lazyRender,
|
508
|
-
_blankArray = [],
|
509
545
|
_globals = _gsScope._gsDefine.globals,
|
510
546
|
_copy = function(vars) {
|
511
547
|
var copy = {}, p;
|
@@ -514,35 +550,16 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
514
550
|
}
|
515
551
|
return copy;
|
516
552
|
},
|
517
|
-
|
518
|
-
var
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
prev = reversed ? _tinyNum : 0,
|
524
|
-
sibling;
|
525
|
-
if (callback || !this._forcingPlayhead) { //if the user calls a method that moves the playhead (like progress() or time()), it should honor that and skip any pauses (although if there's a callback positioned at that pause, it must jump there and make the call to ensure the time is EXACTLY what it is supposed to be, and then proceed to where the playhead is being forced). Otherwise, imagine placing a pause in the middle of a timeline and then doing timeline.progress(0.9) - it would get stuck where the pause is.
|
526
|
-
tl.pause(startTime);
|
527
|
-
//now find sibling tweens that are EXACTLY at the same spot on the timeline and adjust the _rawPrevTime so that they fire (or don't fire) correctly on the next render. This is primarily to accommodate zero-duration tweens/callbacks that are positioned right on top of a pause. For example, tl.to(...).call(...).addPause(...).call(...) - notice that there's a call() on each side of the pause, so when it's running forward it should call the first one and then pause, and then when resumed, call the other. Zero-duration tweens use _rawPrevTime to sense momentum figure out if events were suppressed when arriving directly on top of that time.
|
528
|
-
sibling = tween._prev;
|
529
|
-
while (sibling && sibling._startTime === startTime) {
|
530
|
-
sibling._rawPrevTime = prev;
|
531
|
-
sibling = sibling._prev;
|
532
|
-
}
|
533
|
-
sibling = tween._next;
|
534
|
-
while (sibling && sibling._startTime === startTime) {
|
535
|
-
sibling._rawPrevTime = next;
|
536
|
-
sibling = sibling._next;
|
537
|
-
}
|
538
|
-
if (callback) {
|
539
|
-
callback.apply(scope || tl.vars.callbackScope || tl, params || _blankArray);
|
540
|
-
}
|
541
|
-
if (this._forcingPlayhead || !tl._paused) { //the callback could have called resume().
|
542
|
-
tl.seek(time);
|
543
|
-
}
|
553
|
+
_applyCycle = function(vars, targets, i) {
|
554
|
+
var alt = vars.cycle,
|
555
|
+
p, val;
|
556
|
+
for (p in alt) {
|
557
|
+
val = alt[p];
|
558
|
+
vars[p] = (typeof(val) === "function") ? val.call(targets[i], i) : val[i % val.length];
|
544
559
|
}
|
560
|
+
delete vars.cycle;
|
545
561
|
},
|
562
|
+
_pauseCallback = _internals.pauseCallback = function() {},
|
546
563
|
_slice = function(a) { //don't use [].slice because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll()
|
547
564
|
var b = [],
|
548
565
|
l = a.length,
|
@@ -552,9 +569,9 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
552
569
|
},
|
553
570
|
p = TimelineLite.prototype = new SimpleTimeline();
|
554
571
|
|
555
|
-
TimelineLite.version = "1.
|
572
|
+
TimelineLite.version = "1.18.0";
|
556
573
|
p.constructor = TimelineLite;
|
557
|
-
p.kill()._gc = p._forcingPlayhead = false;
|
574
|
+
p.kill()._gc = p._forcingPlayhead = p._hasPause = false;
|
558
575
|
|
559
576
|
/* might use later...
|
560
577
|
//translates a local time inside an animation to the corresponding time on the root/global timeline, factoring in all nesting and timeScales.
|
@@ -594,7 +611,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
594
611
|
|
595
612
|
p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
|
596
613
|
var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, callbackScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
|
597
|
-
|
614
|
+
cycle = vars.cycle,
|
615
|
+
copy, i;
|
598
616
|
if (typeof(targets) === "string") {
|
599
617
|
targets = TweenLite.selector(targets) || targets;
|
600
618
|
}
|
@@ -609,10 +627,17 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
609
627
|
stagger *= -1;
|
610
628
|
}
|
611
629
|
for (i = 0; i < targets.length; i++) {
|
612
|
-
|
613
|
-
|
630
|
+
copy = _copy(vars);
|
631
|
+
if (copy.startAt) {
|
632
|
+
copy.startAt = _copy(copy.startAt);
|
633
|
+
if (copy.startAt.cycle) {
|
634
|
+
_applyCycle(copy.startAt, targets, i);
|
635
|
+
}
|
636
|
+
}
|
637
|
+
if (cycle) {
|
638
|
+
_applyCycle(copy, targets, i);
|
614
639
|
}
|
615
|
-
tl.to(targets[i], duration,
|
640
|
+
tl.to(targets[i], duration, copy, i * stagger);
|
616
641
|
}
|
617
642
|
return this.add(tl, position);
|
618
643
|
};
|
@@ -724,7 +749,10 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
724
749
|
|
725
750
|
p.remove = function(value) {
|
726
751
|
if (value instanceof Animation) {
|
727
|
-
|
752
|
+
this._remove(value, false);
|
753
|
+
var tl = value._timeline = value.vars.useFrames ? Animation._rootFramesTimeline : Animation._rootTimeline; //now that it's removed, default it to the root timeline so that if it gets played again, it doesn't jump back into this timeline.
|
754
|
+
value._startTime = (value._paused ? value._pauseTime : tl._time) - ((!value._reversed ? value._totalTime : value.totalDuration() - value._totalTime) / value._timeScale); //ensure that if it gets played again, the timing is correct.
|
755
|
+
return this;
|
728
756
|
} else if (value instanceof Array || (value && value.push && _isArray(value))) {
|
729
757
|
var i = value.length;
|
730
758
|
while (--i > -1) {
|
@@ -767,8 +795,10 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
767
795
|
};
|
768
796
|
|
769
797
|
p.addPause = function(position, callback, params, scope) {
|
770
|
-
var t = TweenLite.delayedCall(0, _pauseCallback,
|
771
|
-
t.
|
798
|
+
var t = TweenLite.delayedCall(0, _pauseCallback, params, scope || this);
|
799
|
+
t.vars.onComplete = t.vars.onReverseComplete = callback;
|
800
|
+
t.data = "isPause";
|
801
|
+
this._hasPause = true;
|
772
802
|
return this.add(t, position);
|
773
803
|
};
|
774
804
|
|
@@ -839,7 +869,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
839
869
|
prevStart = this._startTime,
|
840
870
|
prevTimeScale = this._timeScale,
|
841
871
|
prevPaused = this._paused,
|
842
|
-
tween, isComplete, next, callback, internalForce;
|
872
|
+
tween, isComplete, next, callback, internalForce, pauseTween;
|
843
873
|
if (time >= totalDur) {
|
844
874
|
this._totalTime = this._time = totalDur;
|
845
875
|
if (!this._reversed) if (!this._hasPausedChild()) {
|
@@ -889,9 +919,34 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
889
919
|
}
|
890
920
|
|
891
921
|
} else {
|
922
|
+
|
923
|
+
if (this._hasPause && !this._forcingPlayhead && !suppressEvents) {
|
924
|
+
if (time >= prevTime) {
|
925
|
+
tween = this._first;
|
926
|
+
while (tween && tween._startTime <= time && !pauseTween) {
|
927
|
+
if (!tween._duration) if (tween.data === "isPause" && !tween.ratio && !(tween._startTime === 0 && this._rawPrevTime === 0)) {
|
928
|
+
pauseTween = tween;
|
929
|
+
}
|
930
|
+
tween = tween._next;
|
931
|
+
}
|
932
|
+
} else {
|
933
|
+
tween = this._last;
|
934
|
+
while (tween && tween._startTime >= time && !pauseTween) {
|
935
|
+
if (!tween._duration) if (tween.data === "isPause" && tween._rawPrevTime > 0) {
|
936
|
+
pauseTween = tween;
|
937
|
+
}
|
938
|
+
tween = tween._prev;
|
939
|
+
}
|
940
|
+
}
|
941
|
+
if (pauseTween) {
|
942
|
+
this._time = time = pauseTween._startTime;
|
943
|
+
this._totalTime = time + (this._cycle * (this._totalDuration + this._repeatDelay));
|
944
|
+
}
|
945
|
+
}
|
946
|
+
|
892
947
|
this._totalTime = this._time = this._rawPrevTime = time;
|
893
948
|
}
|
894
|
-
if ((this._time === prevTime || !this._first) && !force && !internalForce) {
|
949
|
+
if ((this._time === prevTime || !this._first) && !force && !internalForce && !pauseTween) {
|
895
950
|
return;
|
896
951
|
} else if (!this._initted) {
|
897
952
|
this._initted = true;
|
@@ -912,6 +967,9 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
912
967
|
if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
|
913
968
|
break;
|
914
969
|
} else if (tween._active || (tween._startTime <= this._time && !tween._paused && !tween._gc)) {
|
970
|
+
if (pauseTween === tween) {
|
971
|
+
this.pause();
|
972
|
+
}
|
915
973
|
if (!tween._reversed) {
|
916
974
|
tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
|
917
975
|
} else {
|
@@ -927,6 +985,15 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
|
|
927
985
|
if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
|
928
986
|
break;
|
929
987
|
} else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) {
|
988
|
+
if (pauseTween === tween) {
|
989
|
+
pauseTween = tween._prev; //the linked list is organized by _startTime, thus it's possible that a tween could start BEFORE the pause and end after it, in which case it would be positioned before the pause tween in the linked list, but we should render it before we pause() the timeline and cease rendering. This is only a concern when going in reverse.
|
990
|
+
while (pauseTween && pauseTween.endTime() > this._time) {
|
991
|
+
pauseTween.render( (pauseTween._reversed ? pauseTween.totalDuration() - ((time - pauseTween._startTime) * pauseTween._timeScale) : (time - pauseTween._startTime) * pauseTween._timeScale), suppressEvents, force);
|
992
|
+
pauseTween = pauseTween._prev;
|
993
|
+
}
|
994
|
+
pauseTween = null;
|
995
|
+
this.pause();
|
996
|
+
}
|
930
997
|
if (!tween._reversed) {
|
931
998
|
tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
|
932
999
|
} else {
|