greensock-rails 1.15.1.0 → 1.16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.
@@ -694,13 +694,14 @@
694
694
  if (!arguments.length) {
695
695
  return this._paused;
696
696
  }
697
- if (value != this._paused) if (this._timeline) {
697
+ var tl = this._timeline,
698
+ raw, elapsed;
699
+ if (value != this._paused) if (tl) {
698
700
  if (!_tickerActive && !value) {
699
701
  _ticker.wake();
700
702
  }
701
- var tl = this._timeline,
702
- raw = tl.rawTime(),
703
- elapsed = raw - this._pauseTime;
703
+ raw = tl.rawTime();
704
+ elapsed = raw - this._pauseTime;
704
705
  if (!value && tl.smoothChildTiming) {
705
706
  this._startTime += elapsed;
706
707
  this._uncache(false);
@@ -911,11 +912,11 @@
911
912
  p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
912
913
  p._notifyPluginsOfEnabled = p._lazy = false;
913
914
 
914
- TweenLite.version = "1.15.1";
915
+ TweenLite.version = "1.16.0";
915
916
  TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
916
917
  TweenLite.defaultOverwrite = "auto";
917
918
  TweenLite.ticker = _ticker;
918
- TweenLite.autoSleep = true;
919
+ TweenLite.autoSleep = 120;
919
920
  TweenLite.lagSmoothing = function(threshold, adjustedLag) {
920
921
  _ticker.lagSmoothing(threshold, adjustedLag);
921
922
  };
@@ -939,6 +940,7 @@
939
940
  _overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0},
940
941
  _rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(),
941
942
  _rootTimeline = Animation._rootTimeline = new SimpleTimeline(),
943
+ _nextGCFrame = 30,
942
944
  _lazyRender = _internals.lazyRender = function() {
943
945
  var i = _lazyTweens.length,
944
946
  tween;
@@ -968,7 +970,8 @@
968
970
  if (_lazyTweens.length) {
969
971
  _lazyRender();
970
972
  }
971
- if (!(_ticker.frame % 120)) { //dump garbage every 120 frames...
973
+ if (_ticker.frame >= _nextGCFrame) { //dump garbage every 120 frames or whatever the user sets TweenLite.autoSleep to
974
+ _nextGCFrame = _ticker.frame + (parseInt(TweenLite.autoSleep, 10) || 120);
972
975
  for (p in _tweenLookup) {
973
976
  a = _tweenLookup[p].tweens;
974
977
  i = a.length;
@@ -1290,7 +1293,7 @@
1290
1293
  } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0.
1291
1294
  this._totalTime = this._time = 0;
1292
1295
  this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0;
1293
- if (prevTime !== 0 || (duration === 0 && prevRawPrevTime > 0 && prevRawPrevTime !== _tinyNum)) {
1296
+ if (prevTime !== 0 || (duration === 0 && prevRawPrevTime > 0)) {
1294
1297
  callback = "onReverseComplete";
1295
1298
  isComplete = this._reversed;
1296
1299
  }
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.15.1
3
- * DATE: 2015-01-20
2
+ * VERSION: 1.16.0
3
+ * DATE: 2015-03-01
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
6
  * Includes all of the following: TweenLite, TweenMax, TimelineLite, TimelineMax, EasePack, CSSPlugin, RoundPropsPlugin, BezierPlugin, AttrPlugin, DirectionalRotationPlugin
@@ -41,7 +41,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
41
41
  p = TweenMax.prototype = TweenLite.to({}, 0.1, {}),
42
42
  _blankArray = [];
43
43
 
44
- TweenMax.version = "1.15.1";
44
+ TweenMax.version = "1.16.0";
45
45
  p.constructor = TweenMax;
46
46
  p.kill()._gc = false;
47
47
  TweenMax.killTweensOf = TweenMax.killDelayedCallsTo = TweenLite.killTweensOf;
@@ -150,7 +150,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
150
150
  } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0.
151
151
  this._totalTime = this._time = this._cycle = 0;
152
152
  this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0;
153
- if (prevTotalTime !== 0 || (duration === 0 && prevRawPrevTime > 0 && prevRawPrevTime !== _tinyNum)) {
153
+ if (prevTotalTime !== 0 || (duration === 0 && prevRawPrevTime > 0)) {
154
154
  callback = "onReverseComplete";
155
155
  isComplete = this._reversed;
156
156
  }
@@ -644,9 +644,24 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
644
644
  },
645
645
  _pauseCallback = _internals.pauseCallback = function(tween, callback, params, scope) {
646
646
  var tl = tween._timeline,
647
- time = tl._totalTime;
648
- 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.
649
- tl.pause(tween._startTime);
647
+ time = tl._totalTime,
648
+ startTime = tween._startTime,
649
+ next = tween.ratio ? _tinyNum : 0,
650
+ prev = tween.ratio ? 0 : _tinyNum,
651
+ sibling;
652
+ 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.
653
+ tl.pause(startTime);
654
+ //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.
655
+ sibling = tween._prev;
656
+ while (sibling && sibling._startTime === startTime) {
657
+ sibling._rawPrevTime = prev;
658
+ sibling = sibling._prev;
659
+ }
660
+ sibling = tween._next;
661
+ while (sibling && sibling._startTime === startTime) {
662
+ sibling._rawPrevTime = next;
663
+ sibling = sibling._next;
664
+ }
650
665
  if (callback) {
651
666
  callback.apply(scope || tl, params || _blankArray);
652
667
  }
@@ -664,7 +679,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
664
679
  },
665
680
  p = TimelineLite.prototype = new SimpleTimeline();
666
681
 
667
- TimelineLite.version = "1.15.1";
682
+ TimelineLite.version = "1.16.0";
668
683
  p.constructor = TimelineLite;
669
684
  p.kill()._gc = p._forcingPlayhead = false;
670
685
 
@@ -975,13 +990,24 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
975
990
  }
976
991
  if (time < 0) {
977
992
  this._active = false;
978
- 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.
993
+ if (this._timeline.autoRemoveChildren && this._reversed) { //ensures proper GC if a timeline is resumed after it's finished reversing.
994
+ internalForce = isComplete = true;
995
+ callback = "onReverseComplete";
996
+ } 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.
979
997
  internalForce = true;
980
998
  }
981
999
  this._rawPrevTime = time;
982
1000
  } else {
983
1001
  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.
984
-
1002
+ 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).
1003
+ tween = this._first;
1004
+ while (tween && tween._startTime === 0) {
1005
+ if (!tween._duration) {
1006
+ isComplete = false;
1007
+ }
1008
+ tween = tween._next;
1009
+ }
1010
+ }
985
1011
  time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline)
986
1012
  if (!this._initted) {
987
1013
  internalForce = true;
@@ -1264,6 +1290,20 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1264
1290
  return this;
1265
1291
  };
1266
1292
 
1293
+ p.paused = function(value) {
1294
+ if (!value) { //if there's a pause directly at the spot from where we're unpausing, skip it.
1295
+ var tween = this._first,
1296
+ time = this._time;
1297
+ while (tween) {
1298
+ if (tween._startTime === time && tween.data === "isPause") {
1299
+ 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.
1300
+ }
1301
+ tween = tween._next;
1302
+ }
1303
+ }
1304
+ return Animation.prototype.paused.apply(this, arguments);
1305
+ };
1306
+
1267
1307
  p.usesFrames = function() {
1268
1308
  var tl = this._timeline;
1269
1309
  while (tl._timeline) {
@@ -1317,7 +1357,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1317
1357
 
1318
1358
  p.constructor = TimelineMax;
1319
1359
  p.kill()._gc = false;
1320
- TimelineMax.version = "1.15.1";
1360
+ TimelineMax.version = "1.16.0";
1321
1361
 
1322
1362
  p.invalidate = function() {
1323
1363
  this._yoyo = (this.vars.yoyo === true);
@@ -1432,12 +1472,24 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1432
1472
  }
1433
1473
  if (time < 0) {
1434
1474
  this._active = false;
1435
- 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.
1475
+ if (this._timeline.autoRemoveChildren && this._reversed) {
1476
+ internalForce = isComplete = true;
1477
+ callback = "onReverseComplete";
1478
+ } 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.
1436
1479
  internalForce = true;
1437
1480
  }
1438
1481
  this._rawPrevTime = time;
1439
1482
  } else {
1440
1483
  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.
1484
+ 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).
1485
+ tween = this._first;
1486
+ while (tween && tween._startTime === 0) {
1487
+ if (!tween._duration) {
1488
+ isComplete = false;
1489
+ }
1490
+ tween = tween._next;
1491
+ }
1492
+ }
1441
1493
  time = 0; //to avoid occasional floating point rounding errors (could cause problems especially with zero-duration tweens at the very beginning of the timeline)
1442
1494
  if (!this._initted) {
1443
1495
  internalForce = true;
@@ -2356,7 +2408,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
2356
2408
  p = CSSPlugin.prototype = new TweenPlugin("css");
2357
2409
 
2358
2410
  p.constructor = CSSPlugin;
2359
- CSSPlugin.version = "1.15.1";
2411
+ CSSPlugin.version = "1.16.0";
2360
2412
  CSSPlugin.API = 2;
2361
2413
  CSSPlugin.defaultTransformPerspective = 0;
2362
2414
  CSSPlugin.defaultSkewType = "compensated";
@@ -2533,11 +2585,20 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
2533
2585
  // @private returns at object containing ALL of the style properties in camelCase and their associated values.
2534
2586
  _getAllStyles = function(t, cs) {
2535
2587
  var s = {},
2536
- i, tr;
2588
+ i, tr, p;
2537
2589
  if ((cs = cs || _getComputedStyle(t, null))) {
2538
- for (i in cs) {
2539
- if (i.indexOf("Transform") === -1 || _transformProp === i) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here.
2540
- s[i] = cs[i];
2590
+ if ((i = cs.length)) {
2591
+ while (--i > -1) {
2592
+ p = cs[i];
2593
+ if (p.indexOf("-transform") === -1 || _transformPropCSS === p) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here.
2594
+ s[p.replace(_camelExp, _camelFunc)] = cs.getPropertyValue(p);
2595
+ }
2596
+ }
2597
+ } else { //some browsers behave differently - cs.length is always 0, so we must do a for...in loop.
2598
+ for (i in cs) {
2599
+ if (i.indexOf("Transform") === -1 || _transformProp === i) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here.
2600
+ s[i] = cs[i];
2601
+ }
2541
2602
  }
2542
2603
  }
2543
2604
  } else if ((cs = t.currentStyle || t.style)) {
@@ -3303,8 +3364,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3303
3364
  bi = b.indexOf(kwd);
3304
3365
  ei = e.indexOf(kwd);
3305
3366
  if (bi !== ei) {
3306
- e = (ei === -1) ? ea : ba;
3307
- e[i] += " " + kwd;
3367
+ if (ei === -1) { //if the keyword isn't in the end value, remove it from the beginning one.
3368
+ ba[i] = ba[i].split(kwd).join("");
3369
+ } else if (bi === -1) { //if the keyword isn't in the beginning, add it.
3370
+ ba[i] += " " + kwd;
3371
+ }
3308
3372
  }
3309
3373
  }
3310
3374
  }
@@ -3371,8 +3435,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3371
3435
 
3372
3436
 
3373
3437
 
3374
-
3375
3438
  //transform-related methods and properties
3439
+ CSSPlugin.useSVGTransformAttr = _isSafari; //Safari has some rendering bugs when applying CSS transforms to SVG elements, so default to using the "transform" attribute instead.
3376
3440
  var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent").split(","),
3377
3441
  _transformProp = _checkPropPrefix("transform"), //the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform.
3378
3442
  _transformPropCSS = _prefixCSS + "transform",
@@ -3396,7 +3460,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3396
3460
  container.appendChild(element);
3397
3461
  return element;
3398
3462
  },
3399
- _docElement = document.documentElement,
3463
+ _docElement = _doc.documentElement,
3400
3464
  _forceSVGTransformAttr = (function() {
3401
3465
  //IE and Android stock don't support CSS transforms on SVG elements, so we must write them to the "transform" attribute. We populate this variable in the _parseTransform() method, and only if/when we come across an SVG element
3402
3466
  var force = _ieVers || (/Android/i.test(_agent) && !window.chrome),
@@ -3412,11 +3476,17 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3412
3476
  }
3413
3477
  return force;
3414
3478
  })(),
3415
- _parseSVGOrigin = function(e, origin, decoratee) {
3416
- var bbox = e.getBBox();
3417
- origin = _parsePosition(origin).split(" ");
3418
- decoratee.xOrigin = (origin[0].indexOf("%") !== -1 ? parseFloat(origin[0]) / 100 * bbox.width : parseFloat(origin[0])) + bbox.x;
3419
- decoratee.yOrigin = (origin[1].indexOf("%") !== -1 ? parseFloat(origin[1]) / 100 * bbox.height : parseFloat(origin[1])) + bbox.y;
3479
+ _parseSVGOrigin = function(e, local, decoratee, absolute) {
3480
+ var bbox, v;
3481
+ if (!absolute || !(v = absolute.split(" ")).length) {
3482
+ bbox = e.getBBox();
3483
+ local = _parsePosition(local).split(" ");
3484
+ v = [(local[0].indexOf("%") !== -1 ? parseFloat(local[0]) / 100 * bbox.width : parseFloat(local[0])) + bbox.x,
3485
+ (local[1].indexOf("%") !== -1 ? parseFloat(local[1]) / 100 * bbox.height : parseFloat(local[1])) + bbox.y];
3486
+ }
3487
+ decoratee.xOrigin = parseFloat(v[0]);
3488
+ decoratee.yOrigin = parseFloat(v[1]);
3489
+ e.setAttribute("data-svg-origin", v.join(" "));
3420
3490
  },
3421
3491
 
3422
3492
  /**
@@ -3448,10 +3518,14 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3448
3518
  isDefault = (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)");
3449
3519
  tm.svg = !!(_SVGElement && typeof(t.getBBox) === "function" && t.getCTM && (!t.parentNode || (t.parentNode.getBBox && t.parentNode.getCTM))); //don't just rely on "instanceof _SVGElement" because if the SVG is embedded via an object tag, it won't work (SVGElement is mapped to a different object)
3450
3520
  if (tm.svg) {
3451
- _parseSVGOrigin(t, _getStyle(t, _transformOriginProp, _cs, false, "50% 50%") + "", tm);
3521
+ if (isDefault && (t.style[_transformProp] + "").indexOf("matrix") !== -1) { //some browsers (like Chrome 40) don't correctly report transforms that are applied inline on an SVG element (they don't get included in the computed style), so we double-check here and accept matrix values
3522
+ s = t.style[_transformProp];
3523
+ isDefault = false;
3524
+ }
3525
+ _parseSVGOrigin(t, _getStyle(t, _transformOriginProp, _cs, false, "50% 50%") + "", tm, t.getAttribute("data-svg-origin"));
3452
3526
  _useSVGTransformAttr = CSSPlugin.useSVGTransformAttr || _forceSVGTransformAttr;
3453
3527
  m = t.getAttribute("transform");
3454
- if (isDefault && m && m.indexOf("matrix") !== -1) { //just in case there's a "transfom" value specified as an attribute instead of CSS style. Only accept a matrix, though.
3528
+ if (isDefault && m && m.indexOf("matrix") !== -1) { //just in case there's a "transform" value specified as an attribute instead of CSS style. Only accept a matrix, though.
3455
3529
  s = m;
3456
3530
  isDefault = 0;
3457
3531
  }
@@ -3539,6 +3613,10 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3539
3613
  tm.x = a14;
3540
3614
  tm.y = a24;
3541
3615
  tm.z = a34;
3616
+ if (tm.svg) {
3617
+ tm.x -= tm.xOrigin - (tm.xOrigin * a11 - tm.yOrigin * a12);
3618
+ tm.y -= tm.yOrigin - (tm.yOrigin * a21 - tm.xOrigin * a22);
3619
+ }
3542
3620
 
3543
3621
  } else if ((!_supports3D || parse || !m.length || tm.x !== m[4] || tm.y !== m[5] || (!tm.rotationX && !tm.rotationY)) && !(tm.x !== undefined && _getStyle(t, "display", cs) === "none")) { //sometimes a 6-element matrix is returned even when we performed 3D transforms, like if rotationX and rotationY are 180. In cases like this, we still need to honor the 3D transforms. If we just rely on the 2D info, it could affect how the data is interpreted, like scaleY might get set to -1 or rotation could get offset by 180 degrees. For example, do a TweenLite.to(element, 1, {css:{rotationX:180, rotationY:180}}) and then later, TweenLite.to(element, 1, {css:{rotationX:0}}) and without this conditional logic in place, it'd jump to a state of being unrotated when the 2nd tween starts. Then again, we need to honor the fact that the user COULD alter the transforms outside of CSSPlugin, like by manually applying new css, so we try to sense that by looking at x and y because if those changed, we know the changes were made outside CSSPlugin and we force a reinterpretation of the matrix values. Also, in Webkit browsers, if the element's "display" is "none", its calculated style value will always return empty, so if we've already recorded the values in the _gsTransform object, we'll just rely on those.
3544
3622
  var k = (m.length >= 6),
@@ -3571,6 +3649,10 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3571
3649
  tm.perspective = defaultTransformPerspective;
3572
3650
  tm.scaleZ = 1;
3573
3651
  }
3652
+ if (tm.svg) {
3653
+ tm.x -= tm.xOrigin - (tm.xOrigin * a - tm.yOrigin * b);
3654
+ tm.y -= tm.yOrigin - (tm.yOrigin * d - tm.xOrigin * c);
3655
+ }
3574
3656
  }
3575
3657
  tm.zOrigin = zOrigin;
3576
3658
  //some browsers have a hard time with very small values like 2.4492935982947064e-16 (notice the "e-" towards the end) and would render the object slightly off. So we round to 0 in these cases. The conditional logic here is faster than calling Math.abs(). Also, browsers tend to render a SLIGHTLY rotated object in a fuzzy way, so we need to snap to exactly 0 when appropriate.
@@ -3583,6 +3665,13 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3583
3665
  //DEBUG: _log("parsed rotation of " + t.getAttribute("id")+": "+(tm.rotationX)+", "+(tm.rotationY)+", "+(tm.rotation)+", scale: "+tm.scaleX+", "+tm.scaleY+", "+tm.scaleZ+", position: "+tm.x+", "+tm.y+", "+tm.z+", perspective: "+tm.perspective);
3584
3666
  if (rec) {
3585
3667
  t._gsTransform = tm; //record to the object's _gsTransform which we use so that tweens can control individual properties independently (we need all the properties to accurately recompose the matrix in the setRatio() method)
3668
+ if (tm.svg) { //if we're supposed to apply transforms to the SVG element's "transform" attribute, make sure there aren't any CSS transforms applied or they'll override the attribute ones. Also clear the transform attribute if we're using CSS, just to be clean.
3669
+ if (_useSVGTransformAttr && t.style[_transformProp]) {
3670
+ _removeProp(t.style, _transformProp);
3671
+ } else if (!_useSVGTransformAttr && t.getAttribute("transform")) {
3672
+ t.removeAttribute("transform");
3673
+ }
3674
+ }
3586
3675
  }
3587
3676
  return tm;
3588
3677
  },
@@ -3687,7 +3776,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3687
3776
  perspective = t.perspective,
3688
3777
  a11, a12, a13, a21, a22, a23, a31, a32, a33, a41, a42, a43,
3689
3778
  zOrigin, min, cos, sin, t1, t2, transform, comma, zero;
3690
- if (v === 1 || v === 0 || !t.force3D) if (t.force3D !== true) if (!t.rotationY && !t.rotationX && sz === 1 && !perspective && !z) { //on the final render (which could be 0 for a from tween), if there are no 3D aspects, render in 2D to free up memory and improve performance especially on mobile devices
3779
+ if (v === 1 || v === 0 || !t.force3D) if (t.force3D !== true) if (!t.rotationY && !t.rotationX && sz === 1 && !perspective && !z && (this.tween._totalTime === this.tween._totalDuration || !this.tween._totalTime)) { //on the final render (which could be 0 for a from tween), if there are no 3D aspects, render in 2D to free up memory and improve performance especially on mobile devices. Check the tween's totalTime/totalDuration too in order to make sure it doesn't happen between repeats if it's a repeating tween.
3691
3780
  _set2DTransformRatio.call(this, v);
3692
3781
  return;
3693
3782
  }
@@ -3843,7 +3932,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3843
3932
  style = targ.style,
3844
3933
  x = t.x,
3845
3934
  y = t.y,
3846
- ang, skew, rnd, sx, sy, a, b, c, d, matrix, min;
3935
+ ang, skew, rnd, sx, sy, a, b, c, d, matrix, min, t1;
3847
3936
  if ((t.rotationX || t.rotationY || t.z || t.force3D === true || (t.force3D === "auto" && v !== 1 && v !== 0)) && !(t.svg && _useSVGTransformAttr) && _supports3D) { //if a 3D tween begins while a 2D one is running, we need to kick the rendering over to the 3D method. For example, imagine a yoyo-ing, infinitely repeating scale tween running, and then the object gets rotated in 3D space with a different tween.
3848
3937
  this.setRatio = _set3DTransformRatio;
3849
3938
  _set3DTransformRatio.call(this, v);
@@ -3853,12 +3942,18 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3853
3942
  sy = t.scaleY;
3854
3943
  if (t.rotation || t.skewX || t.svg) {
3855
3944
  ang = t.rotation * _DEG2RAD;
3856
- skew = ang - t.skewX * _DEG2RAD;
3945
+ skew = t.skewX * _DEG2RAD;
3857
3946
  rnd = 100000;
3858
3947
  a = Math.cos(ang) * sx;
3859
3948
  b = Math.sin(ang) * sx;
3860
- c = Math.sin(skew) * -sy;
3861
- d = Math.cos(skew) * sy;
3949
+ c = Math.sin(ang - skew) * -sy;
3950
+ d = Math.cos(ang - skew) * sy;
3951
+ if (skew && t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does
3952
+ t1 = Math.tan(skew);
3953
+ t1 = Math.sqrt(1 + t1 * t1);
3954
+ c *= t1;
3955
+ d *= t1;
3956
+ }
3862
3957
  if (t.svg) {
3863
3958
  x += t.xOrigin - (t.xOrigin * a + t.yOrigin * c);
3864
3959
  y += t.yOrigin - (t.xOrigin * b + t.yOrigin * d);
@@ -3886,7 +3981,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3886
3981
  p.x = p.y = p.z = p.skewX = p.skewY = p.rotation = p.rotationX = p.rotationY = p.zOrigin = p.xPercent = p.yPercent = 0;
3887
3982
  p.scaleX = p.scaleY = p.scaleZ = 1;
3888
3983
 
3889
- _registerComplexSpecialProp("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent", {parser:function(t, e, p, cssp, pt, plugin, vars) {
3984
+ _registerComplexSpecialProp("transform,scale,scaleX,scaleY,scaleZ,x,y,z,rotation,rotationX,rotationY,rotationZ,skewX,skewY,shortRotation,shortRotationX,shortRotationY,shortRotationZ,transformOrigin,svgOrigin,transformPerspective,directionalRotation,parseTransform,force3D,skewType,xPercent,yPercent", {parser:function(t, e, p, cssp, pt, plugin, vars) {
3890
3985
  if (cssp._lastParsedTransform === vars) { return pt; } //only need to parse the transform once, and only if the browser supports it.
3891
3986
  cssp._lastParsedTransform = vars;
3892
3987
  var m1 = cssp._transform = _getTransform(t, _cs, true, vars.parseTransform),
@@ -3975,15 +4070,15 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
3975
4070
  }
3976
4071
 
3977
4072
  orig = v.transformOrigin;
3978
- if (orig && m1.svg) {
3979
- _parseSVGOrigin(t, _parsePosition(orig), m2);
4073
+ if (m1.svg && (orig || v.svgOrigin)) {
4074
+ _parseSVGOrigin(t, _parsePosition(orig), m2, v.svgOrigin);
3980
4075
  pt = new CSSPropTween(m1, "xOrigin", m1.xOrigin, m2.xOrigin - m1.xOrigin, pt, -1, "transformOrigin");
3981
4076
  pt.b = m1.xOrigin;
3982
4077
  pt.e = pt.xs0 = m2.xOrigin;
3983
4078
  pt = new CSSPropTween(m1, "yOrigin", m1.yOrigin, m2.yOrigin - m1.yOrigin, pt, -1, "transformOrigin");
3984
4079
  pt.b = m1.yOrigin;
3985
4080
  pt.e = pt.xs0 = m2.yOrigin;
3986
- orig = "0px 0px"; //certain browsers (like firefox) completely botch transform-origin, so we must remove it to prevent it from contaminating transforms. We manage it ourselves with xOrigin and yOrigin
4081
+ orig = _useSVGTransformAttr ? null : "0px 0px"; //certain browsers (like firefox) completely botch transform-origin, so we must remove it to prevent it from contaminating transforms. We manage it ourselves with xOrigin and yOrigin
3987
4082
  }
3988
4083
  if (orig || (_supports3D && has3D && m1.zOrigin)) { //if anything 3D is happening and there's a transformOrigin with a z component that's non-zero, we must ensure that the transformOrigin's z-component is set to 0 so that we can manually do those calculations to get around Safari bugs. Even if the user didn't specifically define a "transformOrigin" in this particular tween (maybe they did it via css directly).
3989
4084
  if (_transformProp) {
@@ -4201,8 +4296,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
4201
4296
  var _removeProp = function(s, p) {
4202
4297
  if (p) {
4203
4298
  if (s.removeProperty) {
4204
- if (p.substr(0,2) === "ms") { //Microsoft browsers don't conform to the standard of capping the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example)
4205
- p = "M" + p.substr(1);
4299
+ if (p.substr(0,2) === "ms" || p.substr(0,6) === "webkit") { //Microsoft and some Webkit browsers don't conform to the standard of capitalizing the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example)
4300
+ p = "-" + p;
4206
4301
  }
4207
4302
  s.removeProperty(p.replace(_capsExp, "-$1").toLowerCase());
4208
4303
  } else { //note: old versions of IE use "removeAttribute()" instead of "removeProperty()"
@@ -4390,6 +4485,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
4390
4485
  this._linkCSSP(tpt, null, pt2);
4391
4486
  tpt.setRatio = (threeD && _supports3D) ? _set3DTransformRatio : _transformProp ? _set2DTransformRatio : _setIETransformRatio;
4392
4487
  tpt.data = this._transform || _getTransform(target, _cs, true);
4488
+ tpt.tween = tween;
4393
4489
  _overwriteProps.pop(); //we don't want to force the overwrite of all "transform" tweens of the target - we only care about individual transform properties like scaleX, rotation, etc. The CSSPropTween constructor automatically adds the property to _overwriteProps which is why we need to pop() here.
4394
4490
  }
4395
4491
 
@@ -4725,12 +4821,12 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
4725
4821
  e = [],
4726
4822
  targets = [],
4727
4823
  _reservedProps = TweenLite._internals.reservedProps,
4728
- i, difs, p;
4824
+ i, difs, p, from;
4729
4825
  target = tween._targets || tween.target;
4730
4826
  _getChildStyles(target, b, targets);
4731
- tween.render(duration, true);
4827
+ tween.render(duration, true, true);
4732
4828
  _getChildStyles(target, e);
4733
- tween.render(0, true);
4829
+ tween.render(0, true, true);
4734
4830
  tween._enabled(true);
4735
4831
  i = targets.length;
4736
4832
  while (--i > -1) {
@@ -4742,7 +4838,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
4742
4838
  difs[p] = vars[p];
4743
4839
  }
4744
4840
  }
4745
- results.push( TweenLite.to(targets[i], duration, difs) );
4841
+ from = {};
4842
+ for (p in difs) {
4843
+ from[p] = b[i][p];
4844
+ }
4845
+ results.push(TweenLite.fromTo(targets[i], duration, from, difs));
4746
4846
  }
4747
4847
  }
4748
4848
  return results;
@@ -5235,9 +5335,10 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
5235
5335
  //Elastic
5236
5336
  _createElastic = function(n, f, def) {
5237
5337
  var C = _class("easing." + n, function(amplitude, period) {
5238
- this._p1 = amplitude || 1;
5239
- this._p2 = period || def;
5338
+ this._p1 = (amplitude >= 1) ? amplitude : 1; //note: if amplitude is < 1, we simply adjust the period for a more natural feel. Otherwise the math doesn't work right and the curve starts at 1.
5339
+ this._p2 = (period || def) / (amplitude < 1 ? amplitude : 1);
5240
5340
  this._p3 = this._p2 / _2PI * (Math.asin(1 / this._p1) || 0);
5341
+ this._p2 = _2PI / this._p2; //precalculate to optimize
5241
5342
  }, true),
5242
5343
  p = C.prototype = new Ease();
5243
5344
  p.constructor = C;
@@ -5249,13 +5350,13 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
5249
5350
  };
5250
5351
  _wrap("Elastic",
5251
5352
  _createElastic("ElasticOut", function(p) {
5252
- return this._p1 * Math.pow(2, -10 * p) * Math.sin( (p - this._p3) * _2PI / this._p2 ) + 1;
5353
+ return this._p1 * Math.pow(2, -10 * p) * Math.sin( (p - this._p3) * this._p2 ) + 1;
5253
5354
  }, 0.3),
5254
5355
  _createElastic("ElasticIn", function(p) {
5255
- return -(this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * _2PI / this._p2 ));
5356
+ return -(this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2 ));
5256
5357
  }, 0.3),
5257
5358
  _createElastic("ElasticInOut", function(p) {
5258
- return ((p *= 2) < 1) ? -0.5 * (this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * _2PI / this._p2)) : this._p1 * Math.pow(2, -10 *(p -= 1)) * Math.sin( (p - this._p3) * _2PI / this._p2 ) *0.5 + 1;
5359
+ return ((p *= 2) < 1) ? -0.5 * (this._p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin( (p - this._p3) * this._p2)) : this._p1 * Math.pow(2, -10 *(p -= 1)) * Math.sin( (p - this._p3) * this._p2 ) * 0.5 + 1;
5259
5360
  }, 0.45)
5260
5361
  );
5261
5362
 
@@ -6007,13 +6108,14 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6007
6108
  if (!arguments.length) {
6008
6109
  return this._paused;
6009
6110
  }
6010
- if (value != this._paused) if (this._timeline) {
6111
+ var tl = this._timeline,
6112
+ raw, elapsed;
6113
+ if (value != this._paused) if (tl) {
6011
6114
  if (!_tickerActive && !value) {
6012
6115
  _ticker.wake();
6013
6116
  }
6014
- var tl = this._timeline,
6015
- raw = tl.rawTime(),
6016
- elapsed = raw - this._pauseTime;
6117
+ raw = tl.rawTime();
6118
+ elapsed = raw - this._pauseTime;
6017
6119
  if (!value && tl.smoothChildTiming) {
6018
6120
  this._startTime += elapsed;
6019
6121
  this._uncache(false);
@@ -6224,11 +6326,11 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6224
6326
  p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
6225
6327
  p._notifyPluginsOfEnabled = p._lazy = false;
6226
6328
 
6227
- TweenLite.version = "1.15.1";
6329
+ TweenLite.version = "1.16.0";
6228
6330
  TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
6229
6331
  TweenLite.defaultOverwrite = "auto";
6230
6332
  TweenLite.ticker = _ticker;
6231
- TweenLite.autoSleep = true;
6333
+ TweenLite.autoSleep = 120;
6232
6334
  TweenLite.lagSmoothing = function(threshold, adjustedLag) {
6233
6335
  _ticker.lagSmoothing(threshold, adjustedLag);
6234
6336
  };
@@ -6252,6 +6354,7 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6252
6354
  _overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0},
6253
6355
  _rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(),
6254
6356
  _rootTimeline = Animation._rootTimeline = new SimpleTimeline(),
6357
+ _nextGCFrame = 30,
6255
6358
  _lazyRender = _internals.lazyRender = function() {
6256
6359
  var i = _lazyTweens.length,
6257
6360
  tween;
@@ -6281,7 +6384,8 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6281
6384
  if (_lazyTweens.length) {
6282
6385
  _lazyRender();
6283
6386
  }
6284
- if (!(_ticker.frame % 120)) { //dump garbage every 120 frames...
6387
+ if (_ticker.frame >= _nextGCFrame) { //dump garbage every 120 frames or whatever the user sets TweenLite.autoSleep to
6388
+ _nextGCFrame = _ticker.frame + (parseInt(TweenLite.autoSleep, 10) || 120);
6285
6389
  for (p in _tweenLookup) {
6286
6390
  a = _tweenLookup[p].tweens;
6287
6391
  i = a.length;
@@ -6603,7 +6707,7 @@ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case Tween
6603
6707
  } else if (time < 0.0000001) { //to work around occasional floating point math artifacts, round super small values to 0.
6604
6708
  this._totalTime = this._time = 0;
6605
6709
  this.ratio = this._ease._calcEnd ? this._ease.getRatio(0) : 0;
6606
- if (prevTime !== 0 || (duration === 0 && prevRawPrevTime > 0 && prevRawPrevTime !== _tinyNum)) {
6710
+ if (prevTime !== 0 || (duration === 0 && prevRawPrevTime > 0)) {
6607
6711
  callback = "onReverseComplete";
6608
6712
  isComplete = this._reversed;
6609
6713
  }