greensock-rails 1.15.1.0 → 1.16.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d12a8246dd48a721b95b0893a04bd608094cd38d
4
- data.tar.gz: caf5e03c20e59f8ea2978e62005aab5e27212743
3
+ metadata.gz: 3ded360389e745f73fbddc2674dcb9b280dbddee
4
+ data.tar.gz: 813677e4afaee5fe2500839a644f041ae617b975
5
5
  SHA512:
6
- metadata.gz: 82af37432729b8a17037fae29a2a99b2ffea263c9c089ae8dbc92e0ddf3424f942fb8ee619e9dcbf7788c723e83ffae109b58eab605d265e61db3eb7792d6d26
7
- data.tar.gz: c5227fc9bc6a8376388376259a02d59a7fc77745983f9d1577cd9e92f0ef97322b98a1bc91e2fcba216ec1ac27b7b43ef4c389a053681f8db4a0662b8c05f161
6
+ metadata.gz: 0a9af05d1bc23d18240a517b5683ad627532d01bcf73c2ad0d5e7e7583d801bc23fd25d24d2d96b7b5d8465aec8a610e596d048e7067edbf9fafa5ed8882fbd6
7
+ data.tar.gz: 19a0cb5f7022c241f6a317fc192d8ca3cc61afa30b64b7ffab0e4723d0755525705c709fdb675f0ad96bd5a9d09b72fdaa604eeb7b6377ad52084b65d97eb400
@@ -1,5 +1,5 @@
1
1
  module Greensock
2
2
  module Rails
3
- VERSION = "1.15.1.0"
3
+ VERSION = "1.16.0.0"
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.15.1
3
- * DATE: 2015-01-08
2
+ * VERSION: 1.16.0
3
+ * DATE: 2015-03-01
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2015, GreenSock. All rights reserved.
@@ -15,7 +15,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
15
15
  "use strict";
16
16
 
17
17
  _gsScope._gsDefine("TimelineLite", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) {
18
-
18
+
19
19
  var TimelineLite = function(vars) {
20
20
  SimpleTimeline.call(this, vars);
21
21
  this._labels = {};
@@ -53,9 +53,24 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
53
53
  },
54
54
  _pauseCallback = _internals.pauseCallback = function(tween, callback, params, scope) {
55
55
  var tl = tween._timeline,
56
- time = tl._totalTime;
57
- if ((callback || !this._forcingPlayhead) && tl._rawPrevTime !== tween._startTime) { //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.
58
- tl.pause(tween._startTime);
56
+ time = tl._totalTime,
57
+ startTime = tween._startTime,
58
+ next = tween.ratio ? _tinyNum : 0,
59
+ prev = tween.ratio ? 0 : _tinyNum,
60
+ sibling;
61
+ 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.
62
+ tl.pause(startTime);
63
+ //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.
64
+ sibling = tween._prev;
65
+ while (sibling && sibling._startTime === startTime) {
66
+ sibling._rawPrevTime = prev;
67
+ sibling = sibling._prev;
68
+ }
69
+ sibling = tween._next;
70
+ while (sibling && sibling._startTime === startTime) {
71
+ sibling._rawPrevTime = next;
72
+ sibling = sibling._next;
73
+ }
59
74
  if (callback) {
60
75
  callback.apply(scope || tl, params || _blankArray);
61
76
  }
@@ -73,7 +88,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
73
88
  },
74
89
  p = TimelineLite.prototype = new SimpleTimeline();
75
90
 
76
- TimelineLite.version = "1.15.1";
91
+ TimelineLite.version = "1.16.0";
77
92
  p.constructor = TimelineLite;
78
93
  p.kill()._gc = p._forcingPlayhead = false;
79
94
 
@@ -98,21 +113,21 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
98
113
  return time * scale;
99
114
  }
100
115
  */
101
-
116
+
102
117
  p.to = function(target, duration, vars, position) {
103
118
  var Engine = (vars.repeat && _globals.TweenMax) || TweenLite;
104
119
  return duration ? this.add( new Engine(target, duration, vars), position) : this.set(target, vars, position);
105
120
  };
106
-
121
+
107
122
  p.from = function(target, duration, vars, position) {
108
123
  return this.add( ((vars.repeat && _globals.TweenMax) || TweenLite).from(target, duration, vars), position);
109
124
  };
110
-
125
+
111
126
  p.fromTo = function(target, duration, fromVars, toVars, position) {
112
127
  var Engine = (toVars.repeat && _globals.TweenMax) || TweenLite;
113
128
  return duration ? this.add( Engine.fromTo(target, duration, fromVars, toVars), position) : this.set(target, toVars, position);
114
129
  };
115
-
130
+
116
131
  p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
117
132
  var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, onCompleteScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}),
118
133
  i;
@@ -137,23 +152,23 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
137
152
  }
138
153
  return this.add(tl, position);
139
154
  };
140
-
155
+
141
156
  p.staggerFrom = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
142
157
  vars.immediateRender = (vars.immediateRender != false);
143
158
  vars.runBackwards = true;
144
159
  return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
145
160
  };
146
-
161
+
147
162
  p.staggerFromTo = function(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) {
148
163
  toVars.startAt = fromVars;
149
164
  toVars.immediateRender = (toVars.immediateRender != false && fromVars.immediateRender != false);
150
165
  return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope);
151
166
  };
152
-
167
+
153
168
  p.call = function(callback, params, scope, position) {
154
169
  return this.add( TweenLite.delayedCall(0, callback, params, scope), position);
155
170
  };
156
-
171
+
157
172
  p.set = function(target, vars, position) {
158
173
  position = this._parseTimeOrLabel(position, 0, true);
159
174
  if (vars.immediateRender == null) {
@@ -161,7 +176,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
161
176
  }
162
177
  return this.add( new TweenLite(target, 0, vars), position);
163
178
  };
164
-
179
+
165
180
  TimelineLite.exportRoot = function(vars, ignoreDelayedCalls) {
166
181
  vars = vars || {};
167
182
  if (vars.smoothChildTiming == null) {
@@ -269,7 +284,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
269
284
  }
270
285
  return this;
271
286
  };
272
-
287
+
273
288
  p.append = function(value, offsetOrLabel) {
274
289
  return this.add(value, this._parseTimeOrLabel(null, offsetOrLabel, true, value));
275
290
  };
@@ -277,11 +292,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
277
292
  p.insert = p.insertMultiple = function(value, position, align, stagger) {
278
293
  return this.add(value, position || 0, align, stagger);
279
294
  };
280
-
295
+
281
296
  p.appendMultiple = function(tweens, offsetOrLabel, align, stagger) {
282
297
  return this.add(tweens, this._parseTimeOrLabel(null, offsetOrLabel, true, tweens), align, stagger);
283
298
  };
284
-
299
+
285
300
  p.addLabel = function(label, position) {
286
301
  this._labels[label] = this._parseTimeOrLabel(position);
287
302
  return this;
@@ -292,16 +307,16 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
292
307
  t.data = "isPause"; // we use this flag in TweenLite's render() method to identify it as a special case that shouldn't be triggered when the virtual playhead is LEAVING the exact position where the pause is, otherwise timeline.addPause(1).play(1) would end up paused on the very next tick.
293
308
  return this.add(t, position);
294
309
  };
295
-
310
+
296
311
  p.removeLabel = function(label) {
297
312
  delete this._labels[label];
298
313
  return this;
299
314
  };
300
-
315
+
301
316
  p.getLabelTime = function(label) {
302
317
  return (this._labels[label] != null) ? this._labels[label] : -1;
303
318
  };
304
-
319
+
305
320
  p._parseTimeOrLabel = function(timeOrLabel, offsetOrLabel, appendIfAbsent, ignore) {
306
321
  var i;
307
322
  //if we're about to add a tween/timeline (or an array of them) that's already a child of this timeline, we should remove it first so that it doesn't contaminate the duration().
@@ -334,31 +349,31 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
334
349
  }
335
350
  return Number(timeOrLabel) + offsetOrLabel;
336
351
  };
337
-
352
+
338
353
  p.seek = function(position, suppressEvents) {
339
354
  return this.totalTime((typeof(position) === "number") ? position : this._parseTimeOrLabel(position), (suppressEvents !== false));
340
355
  };
341
-
356
+
342
357
  p.stop = function() {
343
358
  return this.paused(true);
344
359
  };
345
-
360
+
346
361
  p.gotoAndPlay = function(position, suppressEvents) {
347
362
  return this.play(position, suppressEvents);
348
363
  };
349
-
364
+
350
365
  p.gotoAndStop = function(position, suppressEvents) {
351
366
  return this.pause(position, suppressEvents);
352
367
  };
353
-
368
+
354
369
  p.render = function(time, suppressEvents, force) {
355
370
  if (this._gc) {
356
371
  this._enabled(true, false);
357
372
  }
358
373
  var totalDur = (!this._dirty) ? this._totalDuration : this.totalDuration(),
359
- prevTime = this._time,
360
- prevStart = this._startTime,
361
- prevTimeScale = this._timeScale,
374
+ prevTime = this._time,
375
+ prevStart = this._startTime,
376
+ prevTimeScale = this._timeScale,
362
377
  prevPaused = this._paused,
363
378
  tween, isComplete, next, callback, internalForce;
364
379
  if (time >= totalDur) {
@@ -384,13 +399,24 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
384
399
  }
385
400
  if (time < 0) {
386
401
  this._active = false;
387
- if (this._rawPrevTime >= 0 && this._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state.
402
+ if (this._timeline.autoRemoveChildren && this._reversed) { //ensures proper GC if a timeline is resumed after it's finished reversing.
403
+ internalForce = isComplete = true;
404
+ callback = "onReverseComplete";
405
+ } else if (this._rawPrevTime >= 0 && this._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state.
388
406
  internalForce = true;
389
407
  }
390
408
  this._rawPrevTime = time;
391
409
  } else {
392
410
  this._rawPrevTime = (this._duration || !suppressEvents || time || this._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or 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.
393
-
411
+ if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good).
412
+ tween = this._first;
413
+ while (tween && tween._startTime === 0) {
414
+ if (!tween._duration) {
415
+ isComplete = false;
416
+ }
417
+ tween = tween._next;
418
+ }
419
+ }
394
420
  time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline)
395
421
  if (!this._initted) {
396
422
  internalForce = true;
@@ -445,14 +471,14 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
445
471
  tween = next;
446
472
  }
447
473
  }
448
-
474
+
449
475
  if (this._onUpdate) if (!suppressEvents) {
450
476
  if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values.
451
477
  _lazyRender();
452
478
  }
453
479
  this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
454
480
  }
455
-
481
+
456
482
  if (callback) if (!this._gc) if (prevStart === this._startTime || prevTimeScale !== this._timeScale) if (this._time === 0 || totalDur >= this.totalDuration()) { //if one of the tweens that was rendered altered this timeline's startTime (like if an onComplete reversed the timeline), it probably isn't complete. If it is, don't worry, because whatever call altered the startTime would complete if it was necessary at the new time. The only exception is the timeScale property. Also check _gc because there's a chance that kill() could be called in an onUpdate
457
483
  if (isComplete) {
458
484
  if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onComplete on a timeline that reports/checks tweened values.
@@ -468,7 +494,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
468
494
  }
469
495
  }
470
496
  };
471
-
497
+
472
498
  p._hasPausedChild = function() {
473
499
  var tween = this._first;
474
500
  while (tween) {
@@ -479,11 +505,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
479
505
  }
480
506
  return false;
481
507
  };
482
-
508
+
483
509
  p.getChildren = function(nested, tweens, timelines, ignoreBeforeTime) {
484
510
  ignoreBeforeTime = ignoreBeforeTime || -9999999999;
485
- var a = [],
486
- tween = this._first,
511
+ var a = [],
512
+ tween = this._first,
487
513
  cnt = 0;
488
514
  while (tween) {
489
515
  if (tween._startTime < ignoreBeforeTime) {
@@ -505,7 +531,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
505
531
  }
506
532
  return a;
507
533
  };
508
-
534
+
509
535
  p.getTweensOf = function(target, nested) {
510
536
  var disabled = this._gc,
511
537
  a = [],
@@ -530,7 +556,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
530
556
  p.recent = function() {
531
557
  return this._recent;
532
558
  };
533
-
559
+
534
560
  p._contains = function(tween) {
535
561
  var tl = tween.timeline;
536
562
  while (tl) {
@@ -541,7 +567,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
541
567
  }
542
568
  return false;
543
569
  };
544
-
570
+
545
571
  p.shiftChildren = function(amount, adjustLabels, ignoreBeforeTime) {
546
572
  ignoreBeforeTime = ignoreBeforeTime || 0;
547
573
  var tween = this._first,
@@ -562,13 +588,13 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
562
588
  }
563
589
  return this._uncache(true);
564
590
  };
565
-
591
+
566
592
  p._kill = function(vars, target) {
567
593
  if (!vars && !target) {
568
594
  return this._enabled(false, false);
569
595
  }
570
596
  var tweens = (!target) ? this.getChildren(true, true, false) : this.getTweensOf(target),
571
- i = tweens.length,
597
+ i = tweens.length,
572
598
  changed = false;
573
599
  while (--i > -1) {
574
600
  if (tweens[i]._kill(vars, target)) {
@@ -577,7 +603,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
577
603
  }
578
604
  return changed;
579
605
  };
580
-
606
+
581
607
  p.clear = function(labels) {
582
608
  var tweens = this.getChildren(false, true, true),
583
609
  i = tweens.length;
@@ -590,7 +616,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
590
616
  }
591
617
  return this._uncache(true);
592
618
  };
593
-
619
+
594
620
  p.invalidate = function() {
595
621
  var tween = this._first;
596
622
  while (tween) {
@@ -599,7 +625,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
599
625
  }
600
626
  return Animation.prototype.invalidate.call(this);;
601
627
  };
602
-
628
+
603
629
  p._enabled = function(enabled, ignoreTimeline) {
604
630
  if (enabled === this._gc) {
605
631
  var tween = this._first;
@@ -617,7 +643,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
617
643
  this._forcingPlayhead = false;
618
644
  return val;
619
645
  };
620
-
646
+
621
647
  p.duration = function(value) {
622
648
  if (!arguments.length) {
623
649
  if (this._dirty) {
@@ -630,7 +656,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
630
656
  }
631
657
  return this;
632
658
  };
633
-
659
+
634
660
  p.totalDuration = function(value) {
635
661
  if (!arguments.length) {
636
662
  if (this._dirty) {
@@ -672,7 +698,21 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
672
698
  }
673
699
  return this;
674
700
  };
675
-
701
+
702
+ p.paused = function(value) {
703
+ if (!value) { //if there's a pause directly at the spot from where we're unpausing, skip it.
704
+ var tween = this._first,
705
+ time = this._time;
706
+ while (tween) {
707
+ if (tween._startTime === time && tween.data === "isPause") {
708
+ tween._rawPrevTime = time; //remember, _rawPrevTime is how zero-duration tweens/callbacks sense directionality and determine whether or not to fire. If _rawPrevTime is the same as _startTime on the next render, it won't fire.
709
+ }
710
+ tween = tween._next;
711
+ }
712
+ }
713
+ return Animation.prototype.paused.apply(this, arguments);
714
+ };
715
+
676
716
  p.usesFrames = function() {
677
717
  var tl = this._timeline;
678
718
  while (tl._timeline) {
@@ -680,13 +720,13 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
680
720
  }
681
721
  return (tl === Animation._rootFramesTimeline);
682
722
  };
683
-
723
+
684
724
  p.rawTime = function() {
685
725
  return this._paused ? this._totalTime : (this._timeline.rawTime() - this._startTime) * this._timeScale;
686
726
  };
687
-
727
+
688
728
  return TimelineLite;
689
-
729
+
690
730
  }, true);
691
731
 
692
732
 
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.15.1
3
- * DATE: 2015-01-08
2
+ * VERSION: 1.16.0
3
+ * DATE: 2015-03-01
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2015, GreenSock. All rights reserved.
@@ -34,7 +34,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
34
34
 
35
35
  p.constructor = TimelineMax;
36
36
  p.kill()._gc = false;
37
- TimelineMax.version = "1.15.1";
37
+ TimelineMax.version = "1.16.0";
38
38
 
39
39
  p.invalidate = function() {
40
40
  this._yoyo = (this.vars.yoyo === true);
@@ -149,12 +149,24 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
149
149
  }
150
150
  if (time < 0) {
151
151
  this._active = false;
152
- if (prevRawPrevTime >= 0 && this._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state.
152
+ if (this._timeline.autoRemoveChildren && this._reversed) {
153
+ internalForce = isComplete = true;
154
+ callback = "onReverseComplete";
155
+ } else if (prevRawPrevTime >= 0 && this._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state.
153
156
  internalForce = true;
154
157
  }
155
158
  this._rawPrevTime = time;
156
159
  } else {
157
160
  this._rawPrevTime = (dur || !suppressEvents || time || this._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or 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.
161
+ if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good).
162
+ tween = this._first;
163
+ while (tween && tween._startTime === 0) {
164
+ if (!tween._duration) {
165
+ isComplete = false;
166
+ }
167
+ tween = tween._next;
168
+ }
169
+ }
158
170
  time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline)
159
171
  if (!this._initted) {
160
172
  internalForce = true;
@@ -504,9 +516,24 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
504
516
  },
505
517
  _pauseCallback = _internals.pauseCallback = function(tween, callback, params, scope) {
506
518
  var tl = tween._timeline,
507
- time = tl._totalTime;
508
- if ((callback || !this._forcingPlayhead) && tl._rawPrevTime !== tween._startTime) { //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.
509
- tl.pause(tween._startTime);
519
+ time = tl._totalTime,
520
+ startTime = tween._startTime,
521
+ next = tween.ratio ? _tinyNum : 0,
522
+ prev = tween.ratio ? 0 : _tinyNum,
523
+ sibling;
524
+ 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.
525
+ tl.pause(startTime);
526
+ //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.
527
+ sibling = tween._prev;
528
+ while (sibling && sibling._startTime === startTime) {
529
+ sibling._rawPrevTime = prev;
530
+ sibling = sibling._prev;
531
+ }
532
+ sibling = tween._next;
533
+ while (sibling && sibling._startTime === startTime) {
534
+ sibling._rawPrevTime = next;
535
+ sibling = sibling._next;
536
+ }
510
537
  if (callback) {
511
538
  callback.apply(scope || tl, params || _blankArray);
512
539
  }
@@ -524,7 +551,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
524
551
  },
525
552
  p = TimelineLite.prototype = new SimpleTimeline();
526
553
 
527
- TimelineLite.version = "1.15.1";
554
+ TimelineLite.version = "1.16.0";
528
555
  p.constructor = TimelineLite;
529
556
  p.kill()._gc = p._forcingPlayhead = false;
530
557
 
@@ -835,13 +862,24 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
835
862
  }
836
863
  if (time < 0) {
837
864
  this._active = false;
838
- if (this._rawPrevTime >= 0 && this._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state.
865
+ if (this._timeline.autoRemoveChildren && this._reversed) { //ensures proper GC if a timeline is resumed after it's finished reversing.
866
+ internalForce = isComplete = true;
867
+ callback = "onReverseComplete";
868
+ } else if (this._rawPrevTime >= 0 && this._first) { //when going back beyond the start, force a render so that zero-duration tweens that sit at the very beginning render their start values properly. Otherwise, if the parent timeline's playhead lands exactly at this timeline's startTime, and then moves backwards, the zero-duration tweens at the beginning would still be at their end state.
839
869
  internalForce = true;
840
870
  }
841
871
  this._rawPrevTime = time;
842
872
  } else {
843
873
  this._rawPrevTime = (this._duration || !suppressEvents || time || this._rawPrevTime === time) ? time : _tinyNum; //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline or 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.
844
-
874
+ if (time === 0 && isComplete) { //if there's a zero-duration tween at the very beginning of a timeline and the playhead lands EXACTLY at time 0, that tween will correctly render its end values, but we need to keep the timeline alive for one more render so that the beginning values render properly as the parent's playhead keeps moving beyond the begining. Imagine obj.x starts at 0 and then we do tl.set(obj, {x:100}).to(obj, 1, {x:200}) and then later we tl.reverse()...the goal is to have obj.x revert to 0. If the playhead happens to land on exactly 0, without this chunk of code, it'd complete the timeline and remove it from the rendering queue (not good).
875
+ tween = this._first;
876
+ while (tween && tween._startTime === 0) {
877
+ if (!tween._duration) {
878
+ isComplete = false;
879
+ }
880
+ tween = tween._next;
881
+ }
882
+ }
845
883
  time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline)
846
884
  if (!this._initted) {
847
885
  internalForce = true;
@@ -1124,6 +1162,20 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1124
1162
  return this;
1125
1163
  };
1126
1164
 
1165
+ p.paused = function(value) {
1166
+ if (!value) { //if there's a pause directly at the spot from where we're unpausing, skip it.
1167
+ var tween = this._first,
1168
+ time = this._time;
1169
+ while (tween) {
1170
+ if (tween._startTime === time && tween.data === "isPause") {
1171
+ tween._rawPrevTime = time; //remember, _rawPrevTime is how zero-duration tweens/callbacks sense directionality and determine whether or not to fire. If _rawPrevTime is the same as _startTime on the next render, it won't fire.
1172
+ }
1173
+ tween = tween._next;
1174
+ }
1175
+ }
1176
+ return Animation.prototype.paused.apply(this, arguments);
1177
+ };
1178
+
1127
1179
  p.usesFrames = function() {
1128
1180
  var tl = this._timeline;
1129
1181
  while (tl._timeline) {