greensock-rails 1.11.8.0 → 1.12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/greensock/rails/version.rb +1 -1
- data/vendor/assets/javascripts/greensock/TimelineLite.js +15 -11
- data/vendor/assets/javascripts/greensock/TimelineMax.js +15 -12
- data/vendor/assets/javascripts/greensock/TweenLite.js +207 -140
- data/vendor/assets/javascripts/greensock/TweenMax.js +200 -95
- data/vendor/assets/javascripts/greensock/jquery.gsap.js +4 -4
- data/vendor/assets/javascripts/greensock/plugins/AttrPlugin.js +6 -7
- data/vendor/assets/javascripts/greensock/plugins/CSSPlugin.js +42 -24
- data/vendor/assets/javascripts/greensock/utils/Draggable.js +100 -48
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8561239002881c4b075c6bd8cf1942f0f0d6826
|
4
|
+
data.tar.gz: 4d954c37c59064fdbf7d99256801a87c03a20795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdc354762b937c83d75419144e20f578a6c9e3439261ea963a3259ec344e3d8ff5543facad69caaa35acc93d8c569469ecad038bc4244c7404969634ac49ca47
|
7
|
+
data.tar.gz: ad659bfb36a6d74c162f44de453e54711b71ccd447eefdc38162859654e8976100b6e7a6e644e5b2be9fd31f301702accddfe6cae5da8a7232126174e27080e6
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 1.
|
3
|
-
* DATE: 2014-
|
2
|
+
* VERSION: 1.12.1
|
3
|
+
* DATE: 2014-06-26
|
4
4
|
* UPDATES AND DOCS AT: http://www.greensock.com
|
5
5
|
*
|
6
6
|
* @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
|
@@ -56,7 +56,7 @@
|
|
56
56
|
_slice = _blankArray.slice,
|
57
57
|
p = TimelineLite.prototype = new SimpleTimeline();
|
58
58
|
|
59
|
-
TimelineLite.version = "1.
|
59
|
+
TimelineLite.version = "1.12.1";
|
60
60
|
p.constructor = TimelineLite;
|
61
61
|
p.kill()._gc = false;
|
62
62
|
|
@@ -374,13 +374,11 @@
|
|
374
374
|
if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
|
375
375
|
break;
|
376
376
|
} else if (tween._active || (tween._startTime <= this._time && !tween._paused && !tween._gc)) {
|
377
|
-
|
378
377
|
if (!tween._reversed) {
|
379
378
|
tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
|
380
379
|
} else {
|
381
380
|
tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
|
382
381
|
}
|
383
|
-
|
384
382
|
}
|
385
383
|
tween = next;
|
386
384
|
}
|
@@ -391,13 +389,11 @@
|
|
391
389
|
if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
|
392
390
|
break;
|
393
391
|
} else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) {
|
394
|
-
|
395
392
|
if (!tween._reversed) {
|
396
393
|
tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
|
397
394
|
} else {
|
398
395
|
tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
|
399
396
|
}
|
400
|
-
|
401
397
|
}
|
402
398
|
tween = next;
|
403
399
|
}
|
@@ -458,15 +454,23 @@
|
|
458
454
|
};
|
459
455
|
|
460
456
|
p.getTweensOf = function(target, nested) {
|
461
|
-
var
|
462
|
-
|
463
|
-
|
464
|
-
|
457
|
+
var disabled = this._gc,
|
458
|
+
a = [],
|
459
|
+
cnt = 0,
|
460
|
+
tweens, i;
|
461
|
+
if (disabled) {
|
462
|
+
this._enabled(true, true); //getTweensOf() filters out disabled tweens, and we have to mark them as _gc = true when the timeline completes in order to allow clean garbage collection, so temporarily re-enable the timeline here.
|
463
|
+
}
|
464
|
+
tweens = TweenLite.getTweensOf(target);
|
465
|
+
i = tweens.length;
|
465
466
|
while (--i > -1) {
|
466
467
|
if (tweens[i].timeline === this || (nested && this._contains(tweens[i]))) {
|
467
468
|
a[cnt++] = tweens[i];
|
468
469
|
}
|
469
470
|
}
|
471
|
+
if (disabled) {
|
472
|
+
this._enabled(false, true);
|
473
|
+
}
|
470
474
|
return a;
|
471
475
|
};
|
472
476
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 1.
|
3
|
-
* DATE: 2014-
|
2
|
+
* VERSION: 1.12.1
|
3
|
+
* DATE: 2014-06-26
|
4
4
|
* UPDATES AND DOCS AT: http://www.greensock.com
|
5
5
|
*
|
6
6
|
* @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
|
@@ -31,7 +31,7 @@
|
|
31
31
|
|
32
32
|
p.constructor = TimelineMax;
|
33
33
|
p.kill()._gc = false;
|
34
|
-
TimelineMax.version = "1.
|
34
|
+
TimelineMax.version = "1.12.1";
|
35
35
|
|
36
36
|
p.invalidate = function() {
|
37
37
|
this._yoyo = (this.vars.yoyo === true);
|
@@ -276,7 +276,6 @@
|
|
276
276
|
} else {
|
277
277
|
tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
|
278
278
|
}
|
279
|
-
|
280
279
|
}
|
281
280
|
tween = next;
|
282
281
|
}
|
@@ -495,7 +494,7 @@
|
|
495
494
|
_slice = _blankArray.slice,
|
496
495
|
p = TimelineLite.prototype = new SimpleTimeline();
|
497
496
|
|
498
|
-
TimelineLite.version = "1.
|
497
|
+
TimelineLite.version = "1.12.1";
|
499
498
|
p.constructor = TimelineLite;
|
500
499
|
p.kill()._gc = false;
|
501
500
|
|
@@ -813,13 +812,11 @@
|
|
813
812
|
if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
|
814
813
|
break;
|
815
814
|
} else if (tween._active || (tween._startTime <= this._time && !tween._paused && !tween._gc)) {
|
816
|
-
|
817
815
|
if (!tween._reversed) {
|
818
816
|
tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
|
819
817
|
} else {
|
820
818
|
tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
|
821
819
|
}
|
822
|
-
|
823
820
|
}
|
824
821
|
tween = next;
|
825
822
|
}
|
@@ -830,13 +827,11 @@
|
|
830
827
|
if (this._paused && !prevPaused) { //in case a tween pauses the timeline when rendering
|
831
828
|
break;
|
832
829
|
} else if (tween._active || (tween._startTime <= prevTime && !tween._paused && !tween._gc)) {
|
833
|
-
|
834
830
|
if (!tween._reversed) {
|
835
831
|
tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force);
|
836
832
|
} else {
|
837
833
|
tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force);
|
838
834
|
}
|
839
|
-
|
840
835
|
}
|
841
836
|
tween = next;
|
842
837
|
}
|
@@ -897,15 +892,23 @@
|
|
897
892
|
};
|
898
893
|
|
899
894
|
p.getTweensOf = function(target, nested) {
|
900
|
-
var
|
901
|
-
i = tweens.length,
|
895
|
+
var disabled = this._gc,
|
902
896
|
a = [],
|
903
|
-
cnt = 0
|
897
|
+
cnt = 0,
|
898
|
+
tweens, i;
|
899
|
+
if (disabled) {
|
900
|
+
this._enabled(true, true); //getTweensOf() filters out disabled tweens, and we have to mark them as _gc = true when the timeline completes in order to allow clean garbage collection, so temporarily re-enable the timeline here.
|
901
|
+
}
|
902
|
+
tweens = TweenLite.getTweensOf(target);
|
903
|
+
i = tweens.length;
|
904
904
|
while (--i > -1) {
|
905
905
|
if (tweens[i].timeline === this || (nested && this._contains(tweens[i]))) {
|
906
906
|
a[cnt++] = tweens[i];
|
907
907
|
}
|
908
908
|
}
|
909
|
+
if (disabled) {
|
910
|
+
this._enabled(false, true);
|
911
|
+
}
|
909
912
|
return a;
|
910
913
|
};
|
911
914
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/*!
|
2
|
-
* VERSION: 1.
|
3
|
-
* DATE: 2014-
|
2
|
+
* VERSION: 1.12.1
|
3
|
+
* DATE: 2014-06-26
|
4
4
|
* UPDATES AND DOCS AT: http://www.greensock.com
|
5
5
|
*
|
6
6
|
* @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
|
@@ -10,14 +10,14 @@
|
|
10
10
|
* @author: Jack Doyle, jack@greensock.com
|
11
11
|
*/
|
12
12
|
(function(window) {
|
13
|
-
|
13
|
+
|
14
14
|
"use strict";
|
15
15
|
var _globals = window.GreenSockGlobals || window;
|
16
16
|
if (_globals.TweenLite) {
|
17
17
|
return; //in case the core set of classes is already loaded, don't instantiate twice.
|
18
18
|
}
|
19
19
|
var _namespace = function(ns) {
|
20
|
-
var a = ns.split("."),
|
20
|
+
var a = ns.split("."),
|
21
21
|
p = _globals, i;
|
22
22
|
for (i = 0; i < a.length; i++) {
|
23
23
|
p[a[i]] = p = p[a[i]] || {};
|
@@ -156,7 +156,7 @@
|
|
156
156
|
}
|
157
157
|
}
|
158
158
|
};
|
159
|
-
|
159
|
+
|
160
160
|
p = Ease.prototype;
|
161
161
|
p._calcEnd = false;
|
162
162
|
p.getRatio = function(p) {
|
@@ -225,7 +225,7 @@
|
|
225
225
|
_ticker.wake();
|
226
226
|
}
|
227
227
|
};
|
228
|
-
|
228
|
+
|
229
229
|
p.removeEventListener = function(type, callback) {
|
230
230
|
var list = this._listeners[type], i;
|
231
231
|
if (list) {
|
@@ -238,7 +238,7 @@
|
|
238
238
|
}
|
239
239
|
}
|
240
240
|
};
|
241
|
-
|
241
|
+
|
242
242
|
p.dispatchEvent = function(type) {
|
243
243
|
var list = this._listeners[type],
|
244
244
|
i, t, listener;
|
@@ -262,11 +262,11 @@
|
|
262
262
|
* Ticker
|
263
263
|
* ----------------------------------------------------------------
|
264
264
|
*/
|
265
|
-
var _reqAnimFrame = window.requestAnimationFrame,
|
266
|
-
_cancelAnimFrame = window.cancelAnimationFrame,
|
265
|
+
var _reqAnimFrame = window.requestAnimationFrame,
|
266
|
+
_cancelAnimFrame = window.cancelAnimationFrame,
|
267
267
|
_getTime = Date.now || function() {return new Date().getTime();},
|
268
268
|
_lastUpdate = _getTime();
|
269
|
-
|
269
|
+
|
270
270
|
//now try to determine the requestAnimationFrame and cancelAnimationFrame functions and if none are found, we'll use a setTimeout()/clearTimeout() polyfill.
|
271
271
|
a = ["ms","moz","webkit","o"];
|
272
272
|
i = a.length;
|
@@ -279,12 +279,18 @@
|
|
279
279
|
var _self = this,
|
280
280
|
_startTime = _getTime(),
|
281
281
|
_useRAF = (useRAF !== false && _reqAnimFrame),
|
282
|
+
_lagThreshold = 500,
|
283
|
+
_adjustedLag = 33,
|
282
284
|
_fps, _req, _id, _gap, _nextTime,
|
283
285
|
_tick = function(manual) {
|
284
|
-
|
286
|
+
var elapsed = _getTime() - _lastUpdate,
|
287
|
+
overlap, dispatch;
|
288
|
+
if (elapsed > _lagThreshold) {
|
289
|
+
_startTime += elapsed - _adjustedLag;
|
290
|
+
}
|
291
|
+
_lastUpdate += elapsed;
|
285
292
|
_self.time = (_lastUpdate - _startTime) / 1000;
|
286
|
-
|
287
|
-
dispatch;
|
293
|
+
overlap = _self.time - _nextTime;
|
288
294
|
if (!_fps || overlap > 0 || manual === true) {
|
289
295
|
_self.frame++;
|
290
296
|
_nextTime += overlap + (overlap >= _gap ? 0.004 : _gap - overlap);
|
@@ -304,6 +310,11 @@
|
|
304
310
|
_tick(true);
|
305
311
|
};
|
306
312
|
|
313
|
+
_self.lagSmoothing = function(threshold, adjustedLag) {
|
314
|
+
_lagThreshold = threshold || (1 / _tinyNum); //zero should be interpreted as basically unlimited
|
315
|
+
_adjustedLag = Math.min(adjustedLag, _lagThreshold, 0);
|
316
|
+
};
|
317
|
+
|
307
318
|
_self.sleep = function() {
|
308
319
|
if (_id == null) {
|
309
320
|
return;
|
@@ -323,6 +334,8 @@
|
|
323
334
|
_self.wake = function() {
|
324
335
|
if (_id !== null) {
|
325
336
|
_self.sleep();
|
337
|
+
} else if (_self.frame > 10) { //don't trigger lagSmoothing if we're just waking up, and make sure that at least 10 frames have elapsed because of the iOS bug that we work around below with the 1.5-second setTimout().
|
338
|
+
_lastUpdate = _getTime() - _lagThreshold + 5;
|
326
339
|
}
|
327
340
|
_req = (_fps === 0) ? _emptyFunc : (!_useRAF || !_reqAnimFrame) ? function(f) { return setTimeout(f, ((_nextTime - _self.time) * 1000 + 1) | 0); } : _reqAnimFrame;
|
328
341
|
if (_self === _ticker) {
|
@@ -358,7 +371,7 @@
|
|
358
371
|
}
|
359
372
|
}, 1500);
|
360
373
|
});
|
361
|
-
|
374
|
+
|
362
375
|
p = gs.Ticker.prototype = new gs.events.EventDispatcher();
|
363
376
|
p.constructor = gs.Ticker;
|
364
377
|
|
@@ -376,7 +389,7 @@
|
|
376
389
|
this._active = (vars.immediateRender === true);
|
377
390
|
this.data = vars.data;
|
378
391
|
this._reversed = (vars.reversed === true);
|
379
|
-
|
392
|
+
|
380
393
|
if (!_rootTimeline) {
|
381
394
|
return;
|
382
395
|
}
|
@@ -386,7 +399,7 @@
|
|
386
399
|
|
387
400
|
var tl = this.vars.useFrames ? _rootFramesTimeline : _rootTimeline;
|
388
401
|
tl.add(this, tl._time);
|
389
|
-
|
402
|
+
|
390
403
|
if (this.vars.paused) {
|
391
404
|
this.paused(true);
|
392
405
|
}
|
@@ -410,47 +423,47 @@
|
|
410
423
|
};
|
411
424
|
_checkTimeout();
|
412
425
|
|
413
|
-
|
426
|
+
|
414
427
|
p.play = function(from, suppressEvents) {
|
415
428
|
if (from != null) {
|
416
429
|
this.seek(from, suppressEvents);
|
417
430
|
}
|
418
431
|
return this.reversed(false).paused(false);
|
419
432
|
};
|
420
|
-
|
433
|
+
|
421
434
|
p.pause = function(atTime, suppressEvents) {
|
422
435
|
if (atTime != null) {
|
423
436
|
this.seek(atTime, suppressEvents);
|
424
437
|
}
|
425
438
|
return this.paused(true);
|
426
439
|
};
|
427
|
-
|
440
|
+
|
428
441
|
p.resume = function(from, suppressEvents) {
|
429
442
|
if (from != null) {
|
430
443
|
this.seek(from, suppressEvents);
|
431
444
|
}
|
432
445
|
return this.paused(false);
|
433
446
|
};
|
434
|
-
|
447
|
+
|
435
448
|
p.seek = function(time, suppressEvents) {
|
436
449
|
return this.totalTime(Number(time), suppressEvents !== false);
|
437
450
|
};
|
438
|
-
|
451
|
+
|
439
452
|
p.restart = function(includeDelay, suppressEvents) {
|
440
453
|
return this.reversed(false).paused(false).totalTime(includeDelay ? -this._delay : 0, (suppressEvents !== false), true);
|
441
454
|
};
|
442
|
-
|
455
|
+
|
443
456
|
p.reverse = function(from, suppressEvents) {
|
444
457
|
if (from != null) {
|
445
458
|
this.seek((from || this.totalDuration()), suppressEvents);
|
446
459
|
}
|
447
460
|
return this.reversed(true).paused(false);
|
448
461
|
};
|
449
|
-
|
462
|
+
|
450
463
|
p.render = function(time, suppressEvents, force) {
|
451
464
|
//stub - we override this method in subclasses.
|
452
465
|
};
|
453
|
-
|
466
|
+
|
454
467
|
p.invalidate = function() {
|
455
468
|
return this;
|
456
469
|
};
|
@@ -461,12 +474,12 @@
|
|
461
474
|
rawTime;
|
462
475
|
return (!tl || (!this._gc && !this._paused && tl.isActive() && (rawTime = tl.rawTime()) >= startTime && rawTime < startTime + this.totalDuration() / this._timeScale));
|
463
476
|
};
|
464
|
-
|
477
|
+
|
465
478
|
p._enabled = function (enabled, ignoreTimeline) {
|
466
479
|
if (!_tickerActive) {
|
467
480
|
_ticker.wake();
|
468
481
|
}
|
469
|
-
this._gc = !enabled;
|
482
|
+
this._gc = !enabled;
|
470
483
|
this._active = this.isActive();
|
471
484
|
if (ignoreTimeline !== true) {
|
472
485
|
if (enabled && !this.timeline) {
|
@@ -477,17 +490,17 @@
|
|
477
490
|
}
|
478
491
|
return false;
|
479
492
|
};
|
480
|
-
|
481
|
-
|
493
|
+
|
494
|
+
|
482
495
|
p._kill = function(vars, target) {
|
483
496
|
return this._enabled(false, false);
|
484
497
|
};
|
485
|
-
|
498
|
+
|
486
499
|
p.kill = function(vars, target) {
|
487
500
|
this._kill(vars, target);
|
488
501
|
return this;
|
489
502
|
};
|
490
|
-
|
503
|
+
|
491
504
|
p._uncache = function(includeSelf) {
|
492
505
|
var tween = includeSelf ? this : this.timeline;
|
493
506
|
while (tween) {
|
@@ -507,9 +520,9 @@
|
|
507
520
|
}
|
508
521
|
return copy;
|
509
522
|
};
|
510
|
-
|
523
|
+
|
511
524
|
//----Animation getters/setters --------------------------------------------------------
|
512
|
-
|
525
|
+
|
513
526
|
p.eventCallback = function(type, callback, params, scope) {
|
514
527
|
if ((type || "").substr(0,2) === "on") {
|
515
528
|
var v = this.vars;
|
@@ -529,7 +542,7 @@
|
|
529
542
|
}
|
530
543
|
return this;
|
531
544
|
};
|
532
|
-
|
545
|
+
|
533
546
|
p.delay = function(value) {
|
534
547
|
if (!arguments.length) {
|
535
548
|
return this._delay;
|
@@ -540,25 +553,25 @@
|
|
540
553
|
this._delay = value;
|
541
554
|
return this;
|
542
555
|
};
|
543
|
-
|
556
|
+
|
544
557
|
p.duration = function(value) {
|
545
558
|
if (!arguments.length) {
|
546
559
|
this._dirty = false;
|
547
560
|
return this._duration;
|
548
561
|
}
|
549
562
|
this._duration = this._totalDuration = value;
|
550
|
-
this._uncache(true); //true in case it's a TweenMax or TimelineMax that has a repeat - we'll need to refresh the totalDuration.
|
563
|
+
this._uncache(true); //true in case it's a TweenMax or TimelineMax that has a repeat - we'll need to refresh the totalDuration.
|
551
564
|
if (this._timeline.smoothChildTiming) if (this._time > 0) if (this._time < this._duration) if (value !== 0) {
|
552
565
|
this.totalTime(this._totalTime * (value / this._duration), true);
|
553
566
|
}
|
554
567
|
return this;
|
555
568
|
};
|
556
|
-
|
569
|
+
|
557
570
|
p.totalDuration = function(value) {
|
558
571
|
this._dirty = false;
|
559
572
|
return (!arguments.length) ? this._totalDuration : this.duration(value);
|
560
573
|
};
|
561
|
-
|
574
|
+
|
562
575
|
p.time = function(value, suppressEvents) {
|
563
576
|
if (!arguments.length) {
|
564
577
|
return this._time;
|
@@ -568,7 +581,7 @@
|
|
568
581
|
}
|
569
582
|
return this.totalTime((value > this._duration) ? this._duration : value, suppressEvents);
|
570
583
|
};
|
571
|
-
|
584
|
+
|
572
585
|
p.totalTime = function(time, suppressEvents, uncapped) {
|
573
586
|
if (!_tickerActive) {
|
574
587
|
_ticker.wake();
|
@@ -608,6 +621,9 @@
|
|
608
621
|
}
|
609
622
|
if (this._totalTime !== time || this._duration === 0) {
|
610
623
|
this.render(time, suppressEvents, false);
|
624
|
+
if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when someone calls seek() or time() or progress(), they expect an immediate render.
|
625
|
+
_lazyRender();
|
626
|
+
}
|
611
627
|
}
|
612
628
|
}
|
613
629
|
return this;
|
@@ -616,7 +632,7 @@
|
|
616
632
|
p.progress = p.totalProgress = function(value, suppressEvents) {
|
617
633
|
return (!arguments.length) ? this._time / this.duration() : this.totalTime(this.duration() * value, suppressEvents);
|
618
634
|
};
|
619
|
-
|
635
|
+
|
620
636
|
p.startTime = function(value) {
|
621
637
|
if (!arguments.length) {
|
622
638
|
return this._startTime;
|
@@ -629,7 +645,7 @@
|
|
629
645
|
}
|
630
646
|
return this;
|
631
647
|
};
|
632
|
-
|
648
|
+
|
633
649
|
p.timeScale = function(value) {
|
634
650
|
if (!arguments.length) {
|
635
651
|
return this._timeScale;
|
@@ -643,7 +659,7 @@
|
|
643
659
|
this._timeScale = value;
|
644
660
|
return this._uncache(false);
|
645
661
|
};
|
646
|
-
|
662
|
+
|
647
663
|
p.reversed = function(value) {
|
648
664
|
if (!arguments.length) {
|
649
665
|
return this._reversed;
|
@@ -654,7 +670,7 @@
|
|
654
670
|
}
|
655
671
|
return this;
|
656
672
|
};
|
657
|
-
|
673
|
+
|
658
674
|
p.paused = function(value) {
|
659
675
|
if (!arguments.length) {
|
660
676
|
return this._paused;
|
@@ -682,7 +698,7 @@
|
|
682
698
|
}
|
683
699
|
return this;
|
684
700
|
};
|
685
|
-
|
701
|
+
|
686
702
|
|
687
703
|
/*
|
688
704
|
* ----------------------------------------------------------------
|
@@ -693,7 +709,7 @@
|
|
693
709
|
Animation.call(this, 0, vars);
|
694
710
|
this.autoRemoveChildren = this.smoothChildTiming = true;
|
695
711
|
});
|
696
|
-
|
712
|
+
|
697
713
|
p = SimpleTimeline.prototype = new Animation();
|
698
714
|
p.constructor = SimpleTimeline;
|
699
715
|
p.kill()._gc = false;
|
@@ -738,14 +754,14 @@
|
|
738
754
|
}
|
739
755
|
return this;
|
740
756
|
};
|
741
|
-
|
757
|
+
|
742
758
|
p._remove = function(tween, skipDisable) {
|
743
759
|
if (tween.timeline === this) {
|
744
760
|
if (!skipDisable) {
|
745
761
|
tween._enabled(false, true);
|
746
762
|
}
|
747
763
|
tween.timeline = null;
|
748
|
-
|
764
|
+
|
749
765
|
if (tween._prev) {
|
750
766
|
tween._prev._next = tween._next;
|
751
767
|
} else if (this._first === tween) {
|
@@ -756,16 +772,16 @@
|
|
756
772
|
} else if (this._last === tween) {
|
757
773
|
this._last = tween._prev;
|
758
774
|
}
|
759
|
-
|
775
|
+
|
760
776
|
if (this._timeline) {
|
761
777
|
this._uncache(true);
|
762
778
|
}
|
763
779
|
}
|
764
780
|
return this;
|
765
781
|
};
|
766
|
-
|
782
|
+
|
767
783
|
p.render = function(time, suppressEvents, force) {
|
768
|
-
var tween = this._first,
|
784
|
+
var tween = this._first,
|
769
785
|
next;
|
770
786
|
this._totalTime = this._time = this._rawPrevTime = time;
|
771
787
|
while (tween) {
|
@@ -780,15 +796,14 @@
|
|
780
796
|
tween = next;
|
781
797
|
}
|
782
798
|
};
|
783
|
-
|
799
|
+
|
784
800
|
p.rawTime = function() {
|
785
801
|
if (!_tickerActive) {
|
786
802
|
_ticker.wake();
|
787
803
|
}
|
788
|
-
return this._totalTime;
|
804
|
+
return this._totalTime;
|
789
805
|
};
|
790
|
-
|
791
|
-
|
806
|
+
|
792
807
|
/*
|
793
808
|
* ----------------------------------------------------------------
|
794
809
|
* TweenLite
|
@@ -844,7 +859,8 @@
|
|
844
859
|
}
|
845
860
|
}
|
846
861
|
if (this.vars.immediateRender || (duration === 0 && this._delay === 0 && this.vars.immediateRender !== false)) {
|
847
|
-
this.render(
|
862
|
+
this._time = -_tinyNum; //forces a render without having to set the render() "force" parameter to true because we want to allow lazying by default (using the "force" parameter always forces an immediate full render)
|
863
|
+
this.render(-this._delay);
|
848
864
|
}
|
849
865
|
}, true),
|
850
866
|
_isSelector = function(v) {
|
@@ -854,49 +870,73 @@
|
|
854
870
|
var css = {},
|
855
871
|
p;
|
856
872
|
for (p in vars) {
|
857
|
-
if (!_reservedProps[p] && (!(p in target) || p === "x" || p === "y" || p === "width" || p === "height" || p === "className" || p === "border") && (!_plugins[p] || (_plugins[p] && _plugins[p]._autoCSS))) { //note: <img> elements contain read-only "x" and "y" properties. We should also prioritize editing css width/height rather than the element's properties.
|
873
|
+
if (!_reservedProps[p] && (!(p in target) || p === "transform" || p === "x" || p === "y" || p === "width" || p === "height" || p === "className" || p === "border") && (!_plugins[p] || (_plugins[p] && _plugins[p]._autoCSS))) { //note: <img> elements contain read-only "x" and "y" properties. We should also prioritize editing css width/height rather than the element's properties.
|
858
874
|
css[p] = vars[p];
|
859
875
|
delete vars[p];
|
860
876
|
}
|
861
877
|
}
|
862
878
|
vars.css = css;
|
863
879
|
};
|
864
|
-
|
880
|
+
|
865
881
|
p = TweenLite.prototype = new Animation();
|
866
882
|
p.constructor = TweenLite;
|
867
883
|
p.kill()._gc = false;
|
868
|
-
|
884
|
+
|
869
885
|
//----TweenLite defaults, overwrite management, and root updates ----------------------------------------------------
|
870
|
-
|
886
|
+
|
871
887
|
p.ratio = 0;
|
872
888
|
p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
|
873
|
-
p._notifyPluginsOfEnabled = false;
|
874
|
-
|
875
|
-
TweenLite.version = "1.
|
889
|
+
p._notifyPluginsOfEnabled = p._lazy = false;
|
890
|
+
|
891
|
+
TweenLite.version = "1.12.1";
|
876
892
|
TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
|
877
893
|
TweenLite.defaultOverwrite = "auto";
|
878
894
|
TweenLite.ticker = _ticker;
|
879
895
|
TweenLite.autoSleep = true;
|
896
|
+
TweenLite.lagSmoothing = function(threshold, adjustedLag) {
|
897
|
+
_ticker.lagSmoothing(threshold, adjustedLag);
|
898
|
+
};
|
880
899
|
TweenLite.selector = window.$ || window.jQuery || function(e) { if (window.$) { TweenLite.selector = window.$; return window.$(e); } return window.document ? window.document.getElementById((e.charAt(0) === "#") ? e.substr(1) : e) : e; };
|
881
900
|
|
882
|
-
var
|
901
|
+
var _lazyTweens = [],
|
902
|
+
_lazyLookup = {},
|
903
|
+
_internals = TweenLite._internals = {isArray:_isArray, isSelector:_isSelector, lazyTweens:_lazyTweens}, //gives us a way to expose certain private values to other GreenSock classes without contaminating tha main TweenLite object.
|
883
904
|
_plugins = TweenLite._plugins = {},
|
884
|
-
_tweenLookup =
|
905
|
+
_tweenLookup = _internals.tweenLookup = {},
|
885
906
|
_tweenLookupNum = 0,
|
886
|
-
_reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1},
|
907
|
+
_reservedProps = _internals.reservedProps = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, onCompleteScope:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onUpdateScope:1, onStart:1, onStartParams:1, onStartScope:1, onReverseComplete:1, onReverseCompleteParams:1, onReverseCompleteScope:1, onRepeat:1, onRepeatParams:1, onRepeatScope:1, easeParams:1, yoyo:1, immediateRender:1, repeat:1, repeatDelay:1, data:1, paused:1, reversed:1, autoCSS:1, lazy:1},
|
887
908
|
_overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0},
|
888
|
-
_rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(),
|
889
|
-
_rootTimeline = Animation._rootTimeline = new SimpleTimeline()
|
890
|
-
|
909
|
+
_rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(),
|
910
|
+
_rootTimeline = Animation._rootTimeline = new SimpleTimeline(),
|
911
|
+
_lazyRender = function() {
|
912
|
+
var i = _lazyTweens.length;
|
913
|
+
_lazyLookup = {};
|
914
|
+
while (--i > -1) {
|
915
|
+
a = _lazyTweens[i];
|
916
|
+
if (a && a._lazy !== false) {
|
917
|
+
a.render(a._lazy, false, true);
|
918
|
+
a._lazy = false;
|
919
|
+
}
|
920
|
+
}
|
921
|
+
_lazyTweens.length = 0;
|
922
|
+
};
|
923
|
+
|
891
924
|
_rootTimeline._startTime = _ticker.time;
|
892
925
|
_rootFramesTimeline._startTime = _ticker.frame;
|
893
926
|
_rootTimeline._active = _rootFramesTimeline._active = true;
|
894
|
-
|
895
|
-
|
927
|
+
setTimeout(_lazyRender, 1); //on some mobile devices, there isn't a "tick" before code runs which means any lazy renders wouldn't run before the next official "tick".
|
928
|
+
|
929
|
+
Animation._updateRoot = TweenLite.render = function() {
|
930
|
+
var i, a, p;
|
931
|
+
if (_lazyTweens.length) { //if code is run outside of the requestAnimationFrame loop, there may be tweens queued AFTER the engine refreshed, so we need to ensure any pending renders occur before we refresh again.
|
932
|
+
_lazyRender();
|
933
|
+
}
|
896
934
|
_rootTimeline.render((_ticker.time - _rootTimeline._startTime) * _rootTimeline._timeScale, false, false);
|
897
935
|
_rootFramesTimeline.render((_ticker.frame - _rootFramesTimeline._startTime) * _rootFramesTimeline._timeScale, false, false);
|
936
|
+
if (_lazyTweens.length) {
|
937
|
+
_lazyRender();
|
938
|
+
}
|
898
939
|
if (!(_ticker.frame % 120)) { //dump garbage every 120 frames...
|
899
|
-
var i, a, p;
|
900
940
|
for (p in _tweenLookup) {
|
901
941
|
a = _tweenLookup[p].tweens;
|
902
942
|
i = a.length;
|
@@ -921,9 +961,9 @@
|
|
921
961
|
}
|
922
962
|
}
|
923
963
|
};
|
924
|
-
|
964
|
+
|
925
965
|
_ticker.addEventListener("tick", Animation._updateRoot);
|
926
|
-
|
966
|
+
|
927
967
|
var _register = function(target, tween, scrub) {
|
928
968
|
var id = target._gsTweenID, a, i;
|
929
969
|
if (!_tweenLookup[id || (target._gsTweenID = id = "t" + (_tweenLookupNum++))]) {
|
@@ -942,7 +982,7 @@
|
|
942
982
|
}
|
943
983
|
return _tweenLookup[id].tweens;
|
944
984
|
},
|
945
|
-
|
985
|
+
|
946
986
|
_applyOverwrite = function(target, tween, props, mode, siblings) {
|
947
987
|
var i, changed, curTween, l;
|
948
988
|
if (mode === 1 || mode >= 4) {
|
@@ -960,7 +1000,7 @@
|
|
960
1000
|
}
|
961
1001
|
//NOTE: Add 0.0000000001 to overcome floating point errors that can cause the startTime to be VERY slightly off (when a tween's time() is set for example)
|
962
1002
|
var startTime = tween._startTime + _tinyNum,
|
963
|
-
overlaps = [],
|
1003
|
+
overlaps = [],
|
964
1004
|
oCount = 0,
|
965
1005
|
zeroDur = (tween._duration === 0),
|
966
1006
|
globalStart;
|
@@ -977,14 +1017,14 @@
|
|
977
1017
|
overlaps[oCount++] = curTween;
|
978
1018
|
}
|
979
1019
|
}
|
980
|
-
|
1020
|
+
|
981
1021
|
i = oCount;
|
982
1022
|
while (--i > -1) {
|
983
1023
|
curTween = overlaps[i];
|
984
1024
|
if (mode === 2) if (curTween._kill(props, target)) {
|
985
1025
|
changed = true;
|
986
1026
|
}
|
987
|
-
if (mode !== 2 || (!curTween._firstPT && curTween._initted)) {
|
1027
|
+
if (mode !== 2 || (!curTween._firstPT && curTween._initted)) {
|
988
1028
|
if (curTween._enabled(false, false)) { //if all property tweens have been overwritten, kill the tween.
|
989
1029
|
changed = true;
|
990
1030
|
}
|
@@ -992,10 +1032,10 @@
|
|
992
1032
|
}
|
993
1033
|
return changed;
|
994
1034
|
},
|
995
|
-
|
1035
|
+
|
996
1036
|
_checkOverlap = function(tween, reference, zeroDur) {
|
997
|
-
var tl = tween._timeline,
|
998
|
-
ts = tl._timeScale,
|
1037
|
+
var tl = tween._timeline,
|
1038
|
+
ts = tl._timeScale,
|
999
1039
|
t = tween._startTime;
|
1000
1040
|
while (tl._timeline) {
|
1001
1041
|
t += tl._startTime;
|
@@ -1009,23 +1049,30 @@
|
|
1009
1049
|
return (t > reference) ? t - reference : ((zeroDur && t === reference) || (!tween._initted && t - reference < 2 * _tinyNum)) ? _tinyNum : ((t += tween.totalDuration() / tween._timeScale / ts) > reference + _tinyNum) ? 0 : t - reference - _tinyNum;
|
1010
1050
|
};
|
1011
1051
|
|
1012
|
-
|
1052
|
+
|
1013
1053
|
//---- TweenLite instance methods -----------------------------------------------------------------------------
|
1014
1054
|
|
1015
1055
|
p._init = function() {
|
1016
1056
|
var v = this.vars,
|
1017
1057
|
op = this._overwrittenProps,
|
1018
1058
|
dur = this._duration,
|
1019
|
-
immediate = v.immediateRender,
|
1059
|
+
immediate = !!v.immediateRender,
|
1020
1060
|
ease = v.ease,
|
1021
|
-
i, initPlugins, pt, p;
|
1061
|
+
i, initPlugins, pt, p, startVars;
|
1022
1062
|
if (v.startAt) {
|
1023
1063
|
if (this._startAt) {
|
1024
1064
|
this._startAt.render(-1, true); //if we've run a startAt previously (when the tween instantiated), we should revert it so that the values re-instantiate correctly particularly for relative tweens. Without this, a TweenLite.fromTo(obj, 1, {x:"+=100"}, {x:"-=100"}), for example, would actually jump to +=200 because the startAt would run twice, doubling the relative change.
|
1065
|
+
this._startAt.kill();
|
1066
|
+
}
|
1067
|
+
startVars = {};
|
1068
|
+
for (p in v.startAt) { //copy the properties/values into a new object to avoid collisions, like var to = {x:0}, from = {x:500}; timeline.fromTo(e, 1, from, to).fromTo(e, 1, to, from);
|
1069
|
+
startVars[p] = v.startAt[p];
|
1025
1070
|
}
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1071
|
+
startVars.overwrite = false;
|
1072
|
+
startVars.immediateRender = true;
|
1073
|
+
startVars.lazy = (immediate && v.lazy !== false);
|
1074
|
+
startVars.startAt = startVars.delay = null; //no nesting of startAt objects allowed (otherwise it could cause an infinite loop).
|
1075
|
+
this._startAt = TweenLite.to(this.target, 0, startVars);
|
1029
1076
|
if (immediate) {
|
1030
1077
|
if (this._time > 0) {
|
1031
1078
|
this._startAt = null; //tweens that render immediately (like most from() and fromTo() tweens) shouldn't revert when their parent timeline's playhead goes backward past the startTime because the initial render could have happened anytime and it shouldn't be directly correlated to this tween's startTime. Imagine setting up a complex animation where the beginning states of various objects are rendered immediately but the tween doesn't happen for quite some time - if we revert to the starting values as soon as the playhead goes backward past the tween's startTime, it will throw things off visually. Reversion should only happen in TimelineLite/Max instances where immediateRender was false (which is the default in the convenience methods like from()).
|
@@ -1037,6 +1084,7 @@
|
|
1037
1084
|
//from() tweens must be handled uniquely: their beginning values must be rendered but we don't want overwriting to occur yet (when time is still 0). Wait until the tween actually begins before doing all the routines like overwriting. At that time, we should render at the END of the tween to ensure that things initialize correctly (remember, from() tweens go backwards)
|
1038
1085
|
if (this._startAt) {
|
1039
1086
|
this._startAt.render(-1, true);
|
1087
|
+
this._startAt.kill();
|
1040
1088
|
this._startAt = null;
|
1041
1089
|
} else {
|
1042
1090
|
pt = {};
|
@@ -1047,9 +1095,12 @@
|
|
1047
1095
|
}
|
1048
1096
|
pt.overwrite = 0;
|
1049
1097
|
pt.data = "isFromStart"; //we tag the tween with as "isFromStart" so that if [inside a plugin] we need to only do something at the very END of a tween, we have a way of identifying this tween as merely the one that's setting the beginning values for a "from()" tween. For example, clearProps in CSSPlugin should only get applied at the very END of a tween and without this tag, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in.
|
1098
|
+
pt.lazy = (immediate && v.lazy !== false);
|
1099
|
+
pt.immediateRender = immediate; //zero-duration tweens render immediately by default, but if we're not specifically instructed to render this tween immediately, we should skip this and merely _init() to record the starting values (rendering them immediately would push them to completion which is wasteful in that case - we'd have to render(-1) immediately after)
|
1050
1100
|
this._startAt = TweenLite.to(this.target, 0, pt);
|
1051
|
-
if (!
|
1052
|
-
this._startAt.
|
1101
|
+
if (!immediate) {
|
1102
|
+
this._startAt._init(); //ensures that the initial values are recorded
|
1103
|
+
this._startAt._enabled(false); //no need to have the tween render on the next cycle. Disable it because we'll always manually control the renders of the _startAt tween.
|
1053
1104
|
} else if (this._time === 0) {
|
1054
1105
|
return;
|
1055
1106
|
}
|
@@ -1065,7 +1116,7 @@
|
|
1065
1116
|
this._easeType = this._ease._type;
|
1066
1117
|
this._easePower = this._ease._power;
|
1067
1118
|
this._firstPT = null;
|
1068
|
-
|
1119
|
+
|
1069
1120
|
if (this._targets) {
|
1070
1121
|
i = this._targets.length;
|
1071
1122
|
while (--i > -1) {
|
@@ -1076,7 +1127,7 @@
|
|
1076
1127
|
} else {
|
1077
1128
|
initPlugins = this._initProps(this.target, this._propLookup, this._siblings, op);
|
1078
1129
|
}
|
1079
|
-
|
1130
|
+
|
1080
1131
|
if (initPlugins) {
|
1081
1132
|
TweenLite._onPluginEvent("_onInitAllProps", this); //reorders the array in order of priority. Uses a static TweenPlugin method in order to minimize file size in TweenLite
|
1082
1133
|
}
|
@@ -1094,12 +1145,17 @@
|
|
1094
1145
|
this._onUpdate = v.onUpdate;
|
1095
1146
|
this._initted = true;
|
1096
1147
|
};
|
1097
|
-
|
1148
|
+
|
1098
1149
|
p._initProps = function(target, propLookup, siblings, overwrittenProps) {
|
1099
1150
|
var p, i, initPlugins, plugin, pt, v;
|
1100
1151
|
if (target == null) {
|
1101
1152
|
return false;
|
1102
1153
|
}
|
1154
|
+
|
1155
|
+
if (_lazyLookup[target._gsTweenID]) {
|
1156
|
+
_lazyRender(); //if other tweens of the same target have recently initted but haven't rendered yet, we've got to force the render so that the starting values are correct (imagine populating a timeline with a bunch of sequential tweens and then jumping to the end)
|
1157
|
+
}
|
1158
|
+
|
1103
1159
|
if (!this.vars.css) if (target.style) if (target !== window && target.nodeType) if (_plugins.css) if (this.vars.autoCSS !== false) { //it's so common to use TweenLite/Max to animate the css of DOM elements, we assume that if the target is a DOM element, that's what is intended (a convenience so that users don't have to wrap things in css:{}, although we still recommend it for a slight performance boost and better specificity). Note: we cannot check "nodeType" on the window inside an iframe.
|
1104
1160
|
_autoCSS(this.vars, target);
|
1105
1161
|
}
|
@@ -1109,9 +1165,9 @@
|
|
1109
1165
|
if (v) if ((v instanceof Array) || (v.push && _isArray(v))) if (v.join("").indexOf("{self}") !== -1) {
|
1110
1166
|
this.vars[p] = v = this._swapSelfInParams(v, this);
|
1111
1167
|
}
|
1112
|
-
|
1168
|
+
|
1113
1169
|
} else if (_plugins[p] && (plugin = new _plugins[p]())._onInitTween(target, this.vars[p], this)) {
|
1114
|
-
|
1170
|
+
|
1115
1171
|
//t - target [object]
|
1116
1172
|
//p - property [string]
|
1117
1173
|
//s - start [number]
|
@@ -1131,7 +1187,7 @@
|
|
1131
1187
|
if (plugin._onDisable || plugin._onEnable) {
|
1132
1188
|
this._notifyPluginsOfEnabled = true;
|
1133
1189
|
}
|
1134
|
-
|
1190
|
+
|
1135
1191
|
} else {
|
1136
1192
|
this._firstPT = propLookup[p] = pt = {_next:this._firstPT, t:target, p:p, f:(typeof(target[p]) === "function"), n:p, pg:false, pr:0};
|
1137
1193
|
pt.s = (!pt.f) ? parseFloat(target[p]) : target[ ((p.indexOf("set") || typeof(target["get" + p.substr(3)]) !== "function") ? p : "get" + p.substr(3)) ]();
|
@@ -1141,7 +1197,7 @@
|
|
1141
1197
|
pt._next._prev = pt;
|
1142
1198
|
}
|
1143
1199
|
}
|
1144
|
-
|
1200
|
+
|
1145
1201
|
if (overwrittenProps) if (this._kill(overwrittenProps, target)) { //another tween may have tried to overwrite properties of this tween before init() was called (like if two tweens start at the same time, the one created second will run first)
|
1146
1202
|
return this._initProps(target, propLookup, siblings, overwrittenProps);
|
1147
1203
|
}
|
@@ -1149,55 +1205,58 @@
|
|
1149
1205
|
this._kill(propLookup, target);
|
1150
1206
|
return this._initProps(target, propLookup, siblings, overwrittenProps);
|
1151
1207
|
}
|
1208
|
+
if (this._firstPT) if ((this.vars.lazy !== false && this._duration) || (this.vars.lazy && !this._duration)) { //zero duration tweens don't lazy render by default; everything else does.
|
1209
|
+
_lazyLookup[target._gsTweenID] = true;
|
1210
|
+
}
|
1152
1211
|
return initPlugins;
|
1153
1212
|
};
|
1154
|
-
|
1213
|
+
|
1155
1214
|
p.render = function(time, suppressEvents, force) {
|
1156
1215
|
var prevTime = this._time,
|
1157
1216
|
duration = this._duration,
|
1217
|
+
prevRawPrevTime = this._rawPrevTime,
|
1158
1218
|
isComplete, callback, pt, rawPrevTime;
|
1159
1219
|
if (time >= duration) {
|
1160
1220
|
this._totalTime = this._time = duration;
|
1161
1221
|
this.ratio = this._ease._calcEnd ? this._ease.getRatio(1) : 1;
|
1162
|
-
if (!this._reversed) {
|
1222
|
+
if (!this._reversed ) {
|
1163
1223
|
isComplete = true;
|
1164
1224
|
callback = "onComplete";
|
1165
1225
|
}
|
1166
|
-
if (duration === 0) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
|
1167
|
-
rawPrevTime = this._rawPrevTime;
|
1226
|
+
if (duration === 0) if (this._initted || !this.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
|
1168
1227
|
if (this._startTime === this._timeline._duration) { //if a zero-duration tween is at the VERY end of a timeline and that timeline renders at its end, it will typically add a tiny bit of cushion to the render time to prevent rounding errors from getting in the way of tweens rendering their VERY end. If we then reverse() that timeline, the zero-duration tween will trigger its onReverseComplete even though technically the playhead didn't pass over it again. It's a very specific edge case we must accommodate.
|
1169
1228
|
time = 0;
|
1170
1229
|
}
|
1171
|
-
if (time === 0 ||
|
1230
|
+
if (time === 0 || prevRawPrevTime < 0 || prevRawPrevTime === _tinyNum) if (prevRawPrevTime !== time) {
|
1172
1231
|
force = true;
|
1173
|
-
if (
|
1232
|
+
if (prevRawPrevTime > _tinyNum) {
|
1174
1233
|
callback = "onReverseComplete";
|
1175
1234
|
}
|
1176
1235
|
}
|
1177
|
-
this._rawPrevTime = rawPrevTime = (!suppressEvents || time ||
|
1236
|
+
this._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
|
1178
1237
|
}
|
1179
|
-
|
1238
|
+
|
1180
1239
|
} else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0.
|
1181
1240
|
this._totalTime = this._time = 0;
|
1182
1241
|
this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0;
|
1183
|
-
if (prevTime !== 0 || (duration === 0 &&
|
1242
|
+
if (prevTime !== 0 || (duration === 0 && prevRawPrevTime > 0 && prevRawPrevTime !== _tinyNum)) {
|
1184
1243
|
callback = "onReverseComplete";
|
1185
1244
|
isComplete = this._reversed;
|
1186
1245
|
}
|
1187
1246
|
if (time < 0) {
|
1188
1247
|
this._active = false;
|
1189
|
-
if (duration === 0) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
|
1190
|
-
if (
|
1248
|
+
if (duration === 0) if (this._initted || !this.vars.lazy || force) { //zero-duration tweens are tricky because we must discern the momentum/direction of time in order to determine whether the starting values should be rendered or the ending values. If the "playhead" of its timeline goes past the zero-duration tween in the forward direction or lands directly on it, the end values should be rendered, but if the timeline's "playhead" moves past it in the backward direction (from a postitive time to a negative time), the starting values must be rendered.
|
1249
|
+
if (prevRawPrevTime >= 0) {
|
1191
1250
|
force = true;
|
1192
1251
|
}
|
1193
|
-
this._rawPrevTime = rawPrevTime = (!suppressEvents || time ||
|
1252
|
+
this._rawPrevTime = rawPrevTime = (!suppressEvents || time || prevRawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. We set the _rawPrevTime to be a precise tiny number to indicate this scenario rather than using another property/variable which would increase memory usage. This technique is less readable, but more efficient.
|
1194
1253
|
}
|
1195
1254
|
} else if (!this._initted) { //if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately.
|
1196
1255
|
force = true;
|
1197
1256
|
}
|
1198
1257
|
} else {
|
1199
1258
|
this._totalTime = this._time = time;
|
1200
|
-
|
1259
|
+
|
1201
1260
|
if (this._easeType) {
|
1202
1261
|
var r = time / duration, type = this._easeType, pow = this._easePower;
|
1203
1262
|
if (type === 1 || (type === 3 && r >= 0.5)) {
|
@@ -1215,7 +1274,7 @@
|
|
1215
1274
|
} else if (pow === 4) {
|
1216
1275
|
r *= r * r * r * r;
|
1217
1276
|
}
|
1218
|
-
|
1277
|
+
|
1219
1278
|
if (type === 1) {
|
1220
1279
|
this.ratio = 1 - r;
|
1221
1280
|
} else if (type === 2) {
|
@@ -1225,11 +1284,10 @@
|
|
1225
1284
|
} else {
|
1226
1285
|
this.ratio = 1 - (r / 2);
|
1227
1286
|
}
|
1228
|
-
|
1287
|
+
|
1229
1288
|
} else {
|
1230
1289
|
this.ratio = this._ease.getRatio(time / duration);
|
1231
1290
|
}
|
1232
|
-
|
1233
1291
|
}
|
1234
1292
|
|
1235
1293
|
if (this._time === prevTime && !force) {
|
@@ -1238,6 +1296,12 @@
|
|
1238
1296
|
this._init();
|
1239
1297
|
if (!this._initted || this._gc) { //immediateRender tweens typically won't initialize until the playhead advances (_time is greater than 0) in order to ensure that overwriting occurs properly. Also, if all of the tweening properties have been overwritten (which would cause _gc to be true, as set in _init()), we shouldn't continue otherwise an onStart callback could be called for example.
|
1240
1298
|
return;
|
1299
|
+
} else if (!force && this._firstPT && ((this.vars.lazy !== false && this._duration) || (this.vars.lazy && !this._duration))) {
|
1300
|
+
this._time = this._totalTime = prevTime;
|
1301
|
+
this._rawPrevTime = prevRawPrevTime;
|
1302
|
+
_lazyTweens.push(this);
|
1303
|
+
this._lazy = time;
|
1304
|
+
return;
|
1241
1305
|
}
|
1242
1306
|
//_ease is initially set to defaultEase, so now that init() has run, _ease is set properly and we need to recalculate the ratio. Overall this is faster than using conditional logic earlier in the method to avoid having to set ratio twice because we only init() once but renderTime() gets called VERY frequently.
|
1243
1307
|
if (this._time && !isComplete) {
|
@@ -1246,7 +1310,9 @@
|
|
1246
1310
|
this.ratio = this._ease.getRatio((this._time === 0) ? 0 : 1);
|
1247
1311
|
}
|
1248
1312
|
}
|
1249
|
-
|
1313
|
+
if (this._lazy !== false) { //in case a lazy render is pending, we should flush it because the new render is occuring now (imagine a lazy tween instantiating and then immediately the user calls tween.seek(tween.duration()), skipping to the end - the end render would be forced, and then if we didn't flush the lazy render, it'd fire AFTER the seek(), rendering it at the wrong time.
|
1314
|
+
this._lazy = false;
|
1315
|
+
}
|
1250
1316
|
if (!this._active) if (!this._paused && this._time !== prevTime && time >= 0) {
|
1251
1317
|
this._active = true; //so that if the user renders a tween (as opposed to the timeline rendering it), the timeline is forced to re-render and align it with the proper time/frame on the next rendering cycle. Maybe the tween already finished but the user manually re-renders it as halfway done.
|
1252
1318
|
}
|
@@ -1272,7 +1338,7 @@
|
|
1272
1338
|
}
|
1273
1339
|
pt = pt._next;
|
1274
1340
|
}
|
1275
|
-
|
1341
|
+
|
1276
1342
|
if (this._onUpdate) {
|
1277
1343
|
if (time < 0) if (this._startAt && this._startTime) { //if the tween is positioned at the VERY beginning (_startTime 0) of its parent timeline, it's illegal for the playhead to go back further, so we should not render the recorded startAt values.
|
1278
1344
|
this._startAt.render(time, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete.
|
@@ -1299,14 +1365,15 @@
|
|
1299
1365
|
this._rawPrevTime = 0;
|
1300
1366
|
}
|
1301
1367
|
}
|
1302
|
-
|
1368
|
+
|
1303
1369
|
};
|
1304
|
-
|
1370
|
+
|
1305
1371
|
p._kill = function(vars, target) {
|
1306
1372
|
if (vars === "all") {
|
1307
1373
|
vars = null;
|
1308
1374
|
}
|
1309
1375
|
if (vars == null) if (target == null || target === this.target) {
|
1376
|
+
this._lazy = false;
|
1310
1377
|
return this._enabled(false, false);
|
1311
1378
|
}
|
1312
1379
|
target = (typeof(target) !== "string") ? (target || this._targets || this.target) : TweenLite.selector(target) || target;
|
@@ -1357,7 +1424,7 @@
|
|
1357
1424
|
}
|
1358
1425
|
delete propLookup[p];
|
1359
1426
|
}
|
1360
|
-
if (record) {
|
1427
|
+
if (record) {
|
1361
1428
|
overwrittenProps[p] = 1;
|
1362
1429
|
}
|
1363
1430
|
}
|
@@ -1368,7 +1435,7 @@
|
|
1368
1435
|
}
|
1369
1436
|
return changed;
|
1370
1437
|
};
|
1371
|
-
|
1438
|
+
|
1372
1439
|
p.invalidate = function() {
|
1373
1440
|
if (this._notifyPluginsOfEnabled) {
|
1374
1441
|
TweenLite._onPluginEvent("_onDisable", this);
|
@@ -1377,11 +1444,11 @@
|
|
1377
1444
|
this._overwrittenProps = null;
|
1378
1445
|
this._onUpdate = null;
|
1379
1446
|
this._startAt = null;
|
1380
|
-
this._initted = this._active = this._notifyPluginsOfEnabled = false;
|
1447
|
+
this._initted = this._active = this._notifyPluginsOfEnabled = this._lazy = false;
|
1381
1448
|
this._propLookup = (this._targets) ? {} : [];
|
1382
1449
|
return this;
|
1383
1450
|
};
|
1384
|
-
|
1451
|
+
|
1385
1452
|
p._enabled = function(enabled, ignoreTimeline) {
|
1386
1453
|
if (!_tickerActive) {
|
1387
1454
|
_ticker.wake();
|
@@ -1404,30 +1471,30 @@
|
|
1404
1471
|
}
|
1405
1472
|
return false;
|
1406
1473
|
};
|
1407
|
-
|
1408
|
-
|
1474
|
+
|
1475
|
+
|
1409
1476
|
//----TweenLite static methods -----------------------------------------------------
|
1410
|
-
|
1477
|
+
|
1411
1478
|
TweenLite.to = function(target, duration, vars) {
|
1412
1479
|
return new TweenLite(target, duration, vars);
|
1413
1480
|
};
|
1414
|
-
|
1481
|
+
|
1415
1482
|
TweenLite.from = function(target, duration, vars) {
|
1416
1483
|
vars.runBackwards = true;
|
1417
1484
|
vars.immediateRender = (vars.immediateRender != false);
|
1418
1485
|
return new TweenLite(target, duration, vars);
|
1419
1486
|
};
|
1420
|
-
|
1487
|
+
|
1421
1488
|
TweenLite.fromTo = function(target, duration, fromVars, toVars) {
|
1422
1489
|
toVars.startAt = fromVars;
|
1423
1490
|
toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false);
|
1424
1491
|
return new TweenLite(target, duration, toVars);
|
1425
1492
|
};
|
1426
|
-
|
1493
|
+
|
1427
1494
|
TweenLite.delayedCall = function(delay, callback, params, scope, useFrames) {
|
1428
1495
|
return new TweenLite(callback, 0, {delay:delay, onComplete:callback, onCompleteParams:params, onCompleteScope:scope, onReverseComplete:callback, onReverseCompleteParams:params, onReverseCompleteScope:scope, immediateRender:false, useFrames:useFrames, overwrite:0});
|
1429
1496
|
};
|
1430
|
-
|
1497
|
+
|
1431
1498
|
TweenLite.set = function(target, vars) {
|
1432
1499
|
return new TweenLite(target, 0, vars);
|
1433
1500
|
};
|
@@ -1464,7 +1531,7 @@
|
|
1464
1531
|
}
|
1465
1532
|
return a;
|
1466
1533
|
};
|
1467
|
-
|
1534
|
+
|
1468
1535
|
TweenLite.killTweensOf = TweenLite.killDelayedCallsTo = function(target, onlyActive, vars) {
|
1469
1536
|
if (typeof(onlyActive) === "object") {
|
1470
1537
|
vars = onlyActive; //for backwards compatibility (before "onlyActive" parameter was inserted)
|
@@ -1476,9 +1543,9 @@
|
|
1476
1543
|
a[i]._kill(vars, target);
|
1477
1544
|
}
|
1478
1545
|
};
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1546
|
+
|
1547
|
+
|
1548
|
+
|
1482
1549
|
/*
|
1483
1550
|
* ----------------------------------------------------------------
|
1484
1551
|
* TweenPlugin (could easily be split out as a separate file/class, but included for ease of use (so that people don't need to include another <script> call before loading plugins which is easy to forget)
|
@@ -1490,12 +1557,12 @@
|
|
1490
1557
|
this._priority = priority || 0;
|
1491
1558
|
this._super = TweenPlugin.prototype;
|
1492
1559
|
}, true);
|
1493
|
-
|
1560
|
+
|
1494
1561
|
p = TweenPlugin.prototype;
|
1495
1562
|
TweenPlugin.version = "1.10.1";
|
1496
1563
|
TweenPlugin.API = 2;
|
1497
|
-
p._firstPT = null;
|
1498
|
-
|
1564
|
+
p._firstPT = null;
|
1565
|
+
|
1499
1566
|
p._addTween = function(target, prop, start, end, overwriteProp, round) {
|
1500
1567
|
var c, pt;
|
1501
1568
|
if (end != null && (c = (typeof(end) === "number" || end.charAt(1) !== "=") ? Number(end) - start : parseInt(end.charAt(0) + "1", 10) * Number(end.substr(2)))) {
|
@@ -1506,7 +1573,7 @@
|
|
1506
1573
|
return pt;
|
1507
1574
|
}
|
1508
1575
|
};
|
1509
|
-
|
1576
|
+
|
1510
1577
|
p.setRatio = function(v) {
|
1511
1578
|
var pt = this._firstPT,
|
1512
1579
|
min = 0.000001,
|
@@ -1526,7 +1593,7 @@
|
|
1526
1593
|
pt = pt._next;
|
1527
1594
|
}
|
1528
1595
|
};
|
1529
|
-
|
1596
|
+
|
1530
1597
|
p._kill = function(lookup) {
|
1531
1598
|
var a = this._overwriteProps,
|
1532
1599
|
pt = this._firstPT,
|
@@ -1557,7 +1624,7 @@
|
|
1557
1624
|
}
|
1558
1625
|
return false;
|
1559
1626
|
};
|
1560
|
-
|
1627
|
+
|
1561
1628
|
p._roundProps = function(lookup, value) {
|
1562
1629
|
var pt = this._firstPT;
|
1563
1630
|
while (pt) {
|
@@ -1567,9 +1634,9 @@
|
|
1567
1634
|
pt = pt._next;
|
1568
1635
|
}
|
1569
1636
|
};
|
1570
|
-
|
1637
|
+
|
1571
1638
|
TweenLite._onPluginEvent = function(type, tween) {
|
1572
|
-
var pt = tween._firstPT,
|
1639
|
+
var pt = tween._firstPT,
|
1573
1640
|
changed, pt2, first, last, next;
|
1574
1641
|
if (type === "_onInitAllProps") {
|
1575
1642
|
//sorts the PropTween linked list in order of priority because some plugins need to render earlier/later than others, like MotionBlurPlugin applies its effects after all x/y/alpha tweens have rendered on each frame.
|
@@ -1601,7 +1668,7 @@
|
|
1601
1668
|
}
|
1602
1669
|
return changed;
|
1603
1670
|
};
|
1604
|
-
|
1671
|
+
|
1605
1672
|
TweenPlugin.activate = function(plugins) {
|
1606
1673
|
var i = plugins.length;
|
1607
1674
|
while (--i > -1) {
|
@@ -1639,7 +1706,7 @@
|
|
1639
1706
|
};
|
1640
1707
|
|
1641
1708
|
|
1642
|
-
//now run through all the dependencies discovered and if any are missing, log that to the console as a warning. This is why it's best to have TweenLite load last - it can check all the dependencies for you.
|
1709
|
+
//now run through all the dependencies discovered and if any are missing, log that to the console as a warning. This is why it's best to have TweenLite load last - it can check all the dependencies for you.
|
1643
1710
|
a = window._gsQueue;
|
1644
1711
|
if (a) {
|
1645
1712
|
for (i = 0; i < a.length; i++) {
|
@@ -1653,5 +1720,5 @@
|
|
1653
1720
|
}
|
1654
1721
|
|
1655
1722
|
_tickerActive = false; //ensures that the first official animation forces a ticker.tick() to update the time when it is instantiated
|
1656
|
-
|
1723
|
+
|
1657
1724
|
})(window);
|