greensock-rails 1.12.1.0 → 1.13.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/lib/greensock/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/greensock/TimelineLite.js +64 -13
  4. data/vendor/assets/javascripts/greensock/TimelineMax.js +76 -16
  5. data/vendor/assets/javascripts/greensock/TweenLite.js +34 -25
  6. data/vendor/assets/javascripts/greensock/TweenMax.js +288 -202
  7. data/vendor/assets/javascripts/greensock/easing/EasePack.js +7 -6
  8. data/vendor/assets/javascripts/greensock/jquery.gsap.js +4 -4
  9. data/vendor/assets/javascripts/greensock/plugins/AttrPlugin.js +7 -6
  10. data/vendor/assets/javascripts/greensock/plugins/BezierPlugin.js +22 -7
  11. data/vendor/assets/javascripts/greensock/plugins/CSSPlugin.js +186 -148
  12. data/vendor/assets/javascripts/greensock/plugins/CSSRulePlugin.js +7 -6
  13. data/vendor/assets/javascripts/greensock/plugins/ColorPropsPlugin.js +7 -6
  14. data/vendor/assets/javascripts/greensock/plugins/DirectionalRotationPlugin.js +7 -6
  15. data/vendor/assets/javascripts/greensock/plugins/EaselPlugin.js +7 -6
  16. data/vendor/assets/javascripts/greensock/plugins/EndArrayPlugin.js +7 -6
  17. data/vendor/assets/javascripts/greensock/plugins/KineticPlugin.js +8 -7
  18. data/vendor/assets/javascripts/greensock/plugins/RaphaelPlugin.js +7 -6
  19. data/vendor/assets/javascripts/greensock/plugins/RoundPropsPlugin.js +7 -5
  20. data/vendor/assets/javascripts/greensock/plugins/ScrollToPlugin.js +11 -6
  21. data/vendor/assets/javascripts/greensock/plugins/TEMPLATE_Plugin.js +6 -5
  22. data/vendor/assets/javascripts/greensock/plugins/TextPlugin.js +7 -6
  23. data/vendor/assets/javascripts/greensock/utils/Draggable.js +27 -7
  24. metadata +2 -2
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.12.1
3
- * DATE: 2014-06-26
2
+ * VERSION: 1.13.1
3
+ * DATE: 2014-07-19
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * Includes all of the following: TweenLite, TweenMax, TimelineLite, TimelineMax, EasePack, CSSPlugin, RoundPropsPlugin, BezierPlugin, AttrPlugin, DirectionalRotationPlugin
@@ -11,14 +11,20 @@
11
11
  *
12
12
  * @author: Jack Doyle, jack@greensock.com
13
13
  **/
14
-
15
- (window._gsQueue || (window._gsQueue = [])).push( function() {
14
+ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node
15
+ (_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() {
16
16
 
17
17
  "use strict";
18
18
 
19
- window._gsDefine("TweenMax", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) {
19
+ _gsScope._gsDefine("TweenMax", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) {
20
20
 
21
- var _slice = [].slice,
21
+ var _slice = function(a) { //don't use [].slice because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll()
22
+ var b = [],
23
+ l = a.length,
24
+ i;
25
+ for (i = 0; i !== l; b.push(a[i++]));
26
+ return b;
27
+ },
22
28
  TweenMax = function(target, duration, vars) {
23
29
  TweenLite.call(this, target, duration, vars);
24
30
  this._cycle = 0;
@@ -35,7 +41,7 @@
35
41
  p = TweenMax.prototype = TweenLite.to({}, 0.1, {}),
36
42
  _blankArray = [];
37
43
 
38
- TweenMax.version = "1.12.1";
44
+ TweenMax.version = "1.13.1";
39
45
  p.constructor = TweenMax;
40
46
  p.kill()._gc = false;
41
47
  TweenMax.killTweensOf = TweenMax.killDelayedCallsTo = TweenLite.killTweensOf;
@@ -280,7 +286,7 @@
280
286
  if (this._cycle !== prevCycle) if (!suppressEvents) if (!this._gc) if (this.vars.onRepeat) {
281
287
  this.vars.onRepeat.apply(this.vars.onRepeatScope || this, this.vars.onRepeatParams || _blankArray);
282
288
  }
283
- if (callback) if (!this._gc) { //check gc because there's a chance that kill() could be called in an onUpdate
289
+ if (callback) if (!this._gc || force) { //check gc because there's a chance that kill() could be called in an onUpdate
284
290
  if (time < 0 && this._startAt && !this._onUpdate && 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.
285
291
  this._startAt.render(time, suppressEvents, force);
286
292
  }
@@ -333,7 +339,7 @@
333
339
  targets = TweenLite.selector(targets) || targets;
334
340
  }
335
341
  if (_isSelector(targets)) {
336
- targets = _slice.call(targets, 0);
342
+ targets = _slice(targets);
337
343
  }
338
344
  }
339
345
  l = targets.length;
@@ -431,7 +437,7 @@
431
437
  parent = TweenLite.selector(parent) || parent;
432
438
  }
433
439
  if (_isSelector(parent)) {
434
- parent = _slice.call(parent, 0);
440
+ parent = _slice(parent);
435
441
  }
436
442
  if (_isArray(parent)) {
437
443
  i = parent.length;
@@ -587,7 +593,7 @@
587
593
  * TimelineLite
588
594
  * ----------------------------------------------------------------
589
595
  */
590
- window._gsDefine("TimelineLite", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) {
596
+ _gsScope._gsDefine("TimelineLite", ["core.Animation","core.SimpleTimeline","TweenLite"], function(Animation, SimpleTimeline, TweenLite) {
591
597
 
592
598
  var TimelineLite = function(vars) {
593
599
  SimpleTimeline.call(this, vars);
@@ -609,10 +615,13 @@
609
615
  }
610
616
  },
611
617
  _tinyNum = 0.0000000001,
612
- _isSelector = TweenLite._internals.isSelector,
613
- _isArray = TweenLite._internals.isArray,
618
+ TweenLiteInternals = TweenLite._internals,
619
+ _isSelector = TweenLiteInternals.isSelector,
620
+ _isArray = TweenLiteInternals.isArray,
621
+ _lazyTweens = TweenLiteInternals.lazyTweens,
622
+ _lazyRender = TweenLiteInternals.lazyRender,
614
623
  _blankArray = [],
615
- _globals = window._gsDefine.globals,
624
+ _globals = _gsScope._gsDefine.globals,
616
625
  _copy = function(vars) {
617
626
  var copy = {}, p;
618
627
  for (p in vars) {
@@ -626,13 +635,41 @@
626
635
  callback.apply(scope || tween._timeline, params || _blankArray);
627
636
  }
628
637
  },
629
- _slice = _blankArray.slice,
638
+ _slice = function(a) { //don't use [].slice because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll()
639
+ var b = [],
640
+ l = a.length,
641
+ i;
642
+ for (i = 0; i !== l; b.push(a[i++]));
643
+ return b;
644
+ },
630
645
  p = TimelineLite.prototype = new SimpleTimeline();
631
646
 
632
- TimelineLite.version = "1.12.1";
647
+ TimelineLite.version = "1.13.1";
633
648
  p.constructor = TimelineLite;
634
649
  p.kill()._gc = false;
635
650
 
651
+ /* might use later...
652
+ //translates a local time inside an animation to the corresponding time on the root/global timeline, factoring in all nesting and timeScales.
653
+ function localToGlobal(time, animation) {
654
+ while (animation) {
655
+ time = (time / animation._timeScale) + animation._startTime;
656
+ animation = animation.timeline;
657
+ }
658
+ return time;
659
+ }
660
+
661
+ //translates the supplied time on the root/global timeline into the corresponding local time inside a particular animation, factoring in all nesting and timeScales
662
+ function globalToLocal(time, animation) {
663
+ var scale = 1;
664
+ time -= localToGlobal(0, animation);
665
+ while (animation) {
666
+ scale *= animation._timeScale;
667
+ animation = animation.timeline;
668
+ }
669
+ return time * scale;
670
+ }
671
+ */
672
+
636
673
  p.to = function(target, duration, vars, position) {
637
674
  var Engine = (vars.repeat && _globals.TweenMax) || TweenLite;
638
675
  return duration ? this.add( new Engine(target, duration, vars), position) : this.set(target, vars, position);
@@ -654,7 +691,7 @@
654
691
  targets = TweenLite.selector(targets) || targets;
655
692
  }
656
693
  if (_isSelector(targets)) { //senses if the targets object is a selector. If it is, we should translate it into an array.
657
- targets = _slice.call(targets, 0);
694
+ targets = _slice(targets);
658
695
  }
659
696
  stagger = stagger || 0;
660
697
  for (i = 0; i < targets.length; i++) {
@@ -910,7 +947,7 @@
910
947
  }
911
948
  if (time < 0) {
912
949
  this._active = false;
913
- if (this._duration === 0) if (this._rawPrevTime >= 0 && this._first) { //zero-duration timelines 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.
950
+ 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.
914
951
  internalForce = true;
915
952
  }
916
953
  this._rawPrevTime = time;
@@ -973,11 +1010,17 @@
973
1010
  }
974
1011
 
975
1012
  if (this._onUpdate) if (!suppressEvents) {
1013
+ 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.
1014
+ _lazyRender();
1015
+ }
976
1016
  this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
977
1017
  }
978
1018
 
979
1019
  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
980
1020
  if (isComplete) {
1021
+ 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.
1022
+ _lazyRender();
1023
+ }
981
1024
  if (this._timeline.autoRemoveChildren) {
982
1025
  this._enabled(false, false);
983
1026
  }
@@ -1215,7 +1258,7 @@
1215
1258
  * TimelineMax
1216
1259
  * ----------------------------------------------------------------
1217
1260
  */
1218
- window._gsDefine("TimelineMax", ["TimelineLite","TweenLite","easing.Ease"], function(TimelineLite, TweenLite, Ease) {
1261
+ _gsScope._gsDefine("TimelineMax", ["TimelineLite","TweenLite","easing.Ease"], function(TimelineLite, TweenLite, Ease) {
1219
1262
 
1220
1263
  var TimelineMax = function(vars) {
1221
1264
  TimelineLite.call(this, vars);
@@ -1227,12 +1270,15 @@
1227
1270
  },
1228
1271
  _tinyNum = 0.0000000001,
1229
1272
  _blankArray = [],
1273
+ TweenLiteInternals = TweenLite._internals,
1274
+ _lazyTweens = TweenLiteInternals.lazyTweens,
1275
+ _lazyRender = TweenLiteInternals.lazyRender,
1230
1276
  _easeNone = new Ease(null, null, 1, 0),
1231
1277
  p = TimelineMax.prototype = new TimelineLite();
1232
1278
 
1233
1279
  p.constructor = TimelineMax;
1234
1280
  p.kill()._gc = false;
1235
- TimelineMax.version = "1.12.1";
1281
+ TimelineMax.version = "1.13.1";
1236
1282
 
1237
1283
  p.invalidate = function() {
1238
1284
  this._yoyo = (this.vars.yoyo === true);
@@ -1343,7 +1389,7 @@
1343
1389
  }
1344
1390
  if (time < 0) {
1345
1391
  this._active = false;
1346
- if (dur === 0) if (prevRawPrevTime >= 0 && this._first) { //zero-duration timelines 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.
1392
+ 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.
1347
1393
  internalForce = true;
1348
1394
  }
1349
1395
  this._rawPrevTime = time;
@@ -1483,10 +1529,16 @@
1483
1529
  }
1484
1530
 
1485
1531
  if (this._onUpdate) if (!suppressEvents) {
1532
+ 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.
1533
+ _lazyRender();
1534
+ }
1486
1535
  this._onUpdate.apply(this.vars.onUpdateScope || this, this.vars.onUpdateParams || _blankArray);
1487
1536
  }
1488
1537
  if (callback) if (!this._locked) 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
1489
1538
  if (isComplete) {
1539
+ 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.
1540
+ _lazyRender();
1541
+ }
1490
1542
  if (this._timeline.autoRemoveChildren) {
1491
1543
  this._enabled(false, false);
1492
1544
  }
@@ -1949,10 +2001,10 @@
1949
2001
 
1950
2002
 
1951
2003
 
1952
- BezierPlugin = window._gsDefine.plugin({
2004
+ BezierPlugin = _gsScope._gsDefine.plugin({
1953
2005
  propName: "bezier",
1954
2006
  priority: -1,
1955
- version: "1.3.2",
2007
+ version: "1.3.3",
1956
2008
  API: 2,
1957
2009
  global:true,
1958
2010
 
@@ -2144,7 +2196,7 @@
2144
2196
  };
2145
2197
 
2146
2198
  BezierPlugin._cssRegister = function() {
2147
- var CSSPlugin = window._gsDefine.globals.CSSPlugin;
2199
+ var CSSPlugin = _gsScope._gsDefine.globals.CSSPlugin;
2148
2200
  if (!CSSPlugin) {
2149
2201
  return;
2150
2202
  }
@@ -2243,7 +2295,7 @@
2243
2295
  * CSSPlugin
2244
2296
  * ----------------------------------------------------------------
2245
2297
  */
2246
- window._gsDefine("plugins.CSSPlugin", ["plugins.TweenPlugin","TweenLite"], function(TweenPlugin, TweenLite) {
2298
+ _gsScope._gsDefine("plugins.CSSPlugin", ["plugins.TweenPlugin","TweenLite"], function(TweenPlugin, TweenLite) {
2247
2299
 
2248
2300
  /** @constructor **/
2249
2301
  var CSSPlugin = function() {
@@ -2259,7 +2311,7 @@
2259
2311
  p = CSSPlugin.prototype = new TweenPlugin("css");
2260
2312
 
2261
2313
  p.constructor = CSSPlugin;
2262
- CSSPlugin.version = "1.12.1";
2314
+ CSSPlugin.version = "1.13.1";
2263
2315
  CSSPlugin.API = 2;
2264
2316
  CSSPlugin.defaultTransformPerspective = 0;
2265
2317
  CSSPlugin.defaultSkewType = "compensated";
@@ -3162,7 +3214,7 @@
3162
3214
  if (!_specialProps[p]) {
3163
3215
  var pluginName = p.charAt(0).toUpperCase() + p.substr(1) + "Plugin";
3164
3216
  _registerComplexSpecialProp(p, {parser:function(t, e, p, cssp, pt, plugin, vars) {
3165
- var pluginClass = (window.GreenSockGlobals || window).com.greensock.plugins[pluginName];
3217
+ var pluginClass = (_gsScope.GreenSockGlobals || _gsScope).com.greensock.plugins[pluginName];
3166
3218
  if (!pluginClass) {
3167
3219
  _log("Error: " + pluginName + " js file not loaded.");
3168
3220
  return pt;
@@ -3277,7 +3329,7 @@
3277
3329
 
3278
3330
 
3279
3331
  //transform-related methods and properties
3280
- var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective").split(","),
3332
+ var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent").split(","),
3281
3333
  _transformProp = _checkPropPrefix("transform"), //the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform.
3282
3334
  _transformPropCSS = _prefixCSS + "transform",
3283
3335
  _transformOriginProp = _checkPropPrefix("transformOrigin"),
@@ -3313,151 +3365,156 @@
3313
3365
  s = t.currentStyle.filter.match(_ieGetMatrixExp);
3314
3366
  s = (s && s.length === 4) ? [s[0].substr(4), Number(s[2].substr(4)), Number(s[1].substr(4)), s[3].substr(4), (tm.x || 0), (tm.y || 0)].join(",") : "";
3315
3367
  }
3316
- //split the matrix values out into an array (m for matrix)
3317
- m = (s || "").match(/(?:\-|\b)[\d\-\.e]+\b/gi) || [];
3318
- i = m.length;
3319
- while (--i > -1) {
3320
- n = Number(m[i]);
3321
- m[i] = (dec = n - (n |= 0)) ? ((dec * rnd + (dec < 0 ? -0.5 : 0.5)) | 0) / rnd + n : n; //convert strings to Numbers and round to 5 decimal places to avoid issues with tiny numbers. Roughly 20x faster than Number.toFixed(). We also must make sure to round before dividing so that values like 0.9999999999 become 1 to avoid glitches in browser rendering and interpretation of flipped/rotated 3D matrices. And don't just multiply the number by rnd, floor it, and then divide by rnd because the bitwise operations max out at a 32-bit signed integer, thus it could get clipped at a relatively low value (like 22,000.00000 for example).
3322
- }
3323
- if (m.length === 16) {
3324
-
3325
- //we'll only look at these position-related 6 variables first because if x/y/z all match, it's relatively safe to assume we don't need to re-parse everything which risks losing important rotational information (like rotationX:180 plus rotationY:180 would look the same as rotation:180 - there's no way to know for sure which direction was taken based solely on the matrix3d() values)
3326
- var a13 = m[8], a23 = m[9], a33 = m[10],
3327
- a14 = m[12], a24 = m[13], a34 = m[14];
3328
-
3329
- //we manually compensate for non-zero z component of transformOrigin to work around bugs in Safari
3330
- if (tm.zOrigin) {
3331
- a34 = -tm.zOrigin;
3332
- a14 = a13*a34-m[12];
3333
- a24 = a23*a34-m[13];
3334
- a34 = a33*a34+tm.zOrigin-m[14];
3335
- }
3336
-
3337
- //only parse from the matrix if we MUST because not only is it usually unnecessary due to the fact that we store the values in the _gsTransform object, but also because it's impossible to accurately interpret rotationX, rotationY, rotationZ, scaleX, and scaleY if all are applied, so it's much better to rely on what we store. However, we must parse the first time that an object is tweened. We also assume that if the position has changed, the user must have done some styling changes outside of CSSPlugin, thus we force a parse in that scenario.
3338
- if (!rec || parse || tm.rotationX == null) {
3339
- var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3],
3340
- a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7],
3341
- a43 = m[11],
3342
- angle = Math.atan2(a32, a33),
3343
- xFlip = (angle < -minPI || angle > minPI),
3344
- t1, t2, t3, cos, sin, yFlip, zFlip;
3345
- tm.rotationX = angle * _RAD2DEG;
3346
- //rotationX
3347
- if (angle) {
3348
- cos = Math.cos(-angle);
3349
- sin = Math.sin(-angle);
3350
- t1 = a12*cos+a13*sin;
3351
- t2 = a22*cos+a23*sin;
3352
- t3 = a32*cos+a33*sin;
3353
- a13 = a12*-sin+a13*cos;
3354
- a23 = a22*-sin+a23*cos;
3355
- a33 = a32*-sin+a33*cos;
3356
- a43 = a42*-sin+a43*cos;
3357
- a12 = t1;
3358
- a22 = t2;
3359
- a32 = t3;
3360
- }
3361
- //rotationY
3362
- angle = Math.atan2(a13, a11);
3363
- tm.rotationY = angle * _RAD2DEG;
3364
- if (angle) {
3365
- yFlip = (angle < -minPI || angle > minPI);
3366
- cos = Math.cos(-angle);
3367
- sin = Math.sin(-angle);
3368
- t1 = a11*cos-a13*sin;
3369
- t2 = a21*cos-a23*sin;
3370
- t3 = a31*cos-a33*sin;
3371
- a23 = a21*sin+a23*cos;
3372
- a33 = a31*sin+a33*cos;
3373
- a43 = a41*sin+a43*cos;
3374
- a11 = t1;
3375
- a21 = t2;
3376
- a31 = t3;
3377
- }
3378
- //rotationZ
3379
- angle = Math.atan2(a21, a22);
3380
- tm.rotation = angle * _RAD2DEG;
3381
- if (angle) {
3382
- zFlip = (angle < -minPI || angle > minPI);
3383
- cos = Math.cos(-angle);
3384
- sin = Math.sin(-angle);
3385
- a11 = a11*cos+a12*sin;
3386
- t2 = a21*cos+a22*sin;
3387
- a22 = a21*-sin+a22*cos;
3388
- a32 = a31*-sin+a32*cos;
3389
- a21 = t2;
3368
+ if (!s || s === "none" || s === "matrix(1, 0, 0, 1, 0, 0)") { //if no transforms are applied, just use the defaults to optimize performance (no need to parse).
3369
+ tm = {x:0, y:0, z:0, scaleX:1, scaleY:1, scaleZ:1, skewX:0, perspective:0, rotation:0, rotationX:0, rotationY:0, zOrigin:0};
3370
+ } else {
3371
+ //split the matrix values out into an array (m for matrix)
3372
+ m = (s || "").match(/(?:\-|\b)[\d\-\.e]+\b/gi) || [];
3373
+ i = m.length;
3374
+ while (--i > -1) {
3375
+ n = Number(m[i]);
3376
+ m[i] = (dec = n - (n |= 0)) ? ((dec * rnd + (dec < 0 ? -0.5 : 0.5)) | 0) / rnd + n : n; //convert strings to Numbers and round to 5 decimal places to avoid issues with tiny numbers. Roughly 20x faster than Number.toFixed(). We also must make sure to round before dividing so that values like 0.9999999999 become 1 to avoid glitches in browser rendering and interpretation of flipped/rotated 3D matrices. And don't just multiply the number by rnd, floor it, and then divide by rnd because the bitwise operations max out at a 32-bit signed integer, thus it could get clipped at a relatively low value (like 22,000.00000 for example).
3377
+ }
3378
+ if (m.length === 16) {
3379
+
3380
+ //we'll only look at these position-related 6 variables first because if x/y/z all match, it's relatively safe to assume we don't need to re-parse everything which risks losing important rotational information (like rotationX:180 plus rotationY:180 would look the same as rotation:180 - there's no way to know for sure which direction was taken based solely on the matrix3d() values)
3381
+ var a13 = m[8], a23 = m[9], a33 = m[10],
3382
+ a14 = m[12], a24 = m[13], a34 = m[14];
3383
+
3384
+ //we manually compensate for non-zero z component of transformOrigin to work around bugs in Safari
3385
+ if (tm.zOrigin) {
3386
+ a34 = -tm.zOrigin;
3387
+ a14 = a13*a34-m[12];
3388
+ a24 = a23*a34-m[13];
3389
+ a34 = a33*a34+tm.zOrigin-m[14];
3390
3390
  }
3391
3391
 
3392
- if (zFlip && xFlip) {
3393
- tm.rotation = tm.rotationX = 0;
3394
- } else if (zFlip && yFlip) {
3395
- tm.rotation = tm.rotationY = 0;
3396
- } else if (yFlip && xFlip) {
3397
- tm.rotationY = tm.rotationX = 0;
3392
+ //only parse from the matrix if we MUST because not only is it usually unnecessary due to the fact that we store the values in the _gsTransform object, but also because it's impossible to accurately interpret rotationX, rotationY, rotationZ, scaleX, and scaleY if all are applied, so it's much better to rely on what we store. However, we must parse the first time that an object is tweened. We also assume that if the position has changed, the user must have done some styling changes outside of CSSPlugin, thus we force a parse in that scenario.
3393
+ if (!rec || parse || tm.rotationX == null) {
3394
+ var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3],
3395
+ a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7],
3396
+ a43 = m[11],
3397
+ angle = Math.atan2(a32, a33),
3398
+ xFlip = (angle < -minPI || angle > minPI),
3399
+ t1, t2, t3, cos, sin, yFlip, zFlip;
3400
+ tm.rotationX = angle * _RAD2DEG;
3401
+ //rotationX
3402
+ if (angle) {
3403
+ cos = Math.cos(-angle);
3404
+ sin = Math.sin(-angle);
3405
+ t1 = a12*cos+a13*sin;
3406
+ t2 = a22*cos+a23*sin;
3407
+ t3 = a32*cos+a33*sin;
3408
+ a13 = a12*-sin+a13*cos;
3409
+ a23 = a22*-sin+a23*cos;
3410
+ a33 = a32*-sin+a33*cos;
3411
+ a43 = a42*-sin+a43*cos;
3412
+ a12 = t1;
3413
+ a22 = t2;
3414
+ a32 = t3;
3415
+ }
3416
+ //rotationY
3417
+ angle = Math.atan2(a13, a11);
3418
+ tm.rotationY = angle * _RAD2DEG;
3419
+ if (angle) {
3420
+ yFlip = (angle < -minPI || angle > minPI);
3421
+ cos = Math.cos(-angle);
3422
+ sin = Math.sin(-angle);
3423
+ t1 = a11*cos-a13*sin;
3424
+ t2 = a21*cos-a23*sin;
3425
+ t3 = a31*cos-a33*sin;
3426
+ a23 = a21*sin+a23*cos;
3427
+ a33 = a31*sin+a33*cos;
3428
+ a43 = a41*sin+a43*cos;
3429
+ a11 = t1;
3430
+ a21 = t2;
3431
+ a31 = t3;
3432
+ }
3433
+ //rotationZ
3434
+ angle = Math.atan2(a21, a22);
3435
+ tm.rotation = angle * _RAD2DEG;
3436
+ if (angle) {
3437
+ zFlip = (angle < -minPI || angle > minPI);
3438
+ cos = Math.cos(-angle);
3439
+ sin = Math.sin(-angle);
3440
+ a11 = a11*cos+a12*sin;
3441
+ t2 = a21*cos+a22*sin;
3442
+ a22 = a21*-sin+a22*cos;
3443
+ a32 = a31*-sin+a32*cos;
3444
+ a21 = t2;
3445
+ }
3446
+
3447
+ if (zFlip && xFlip) {
3448
+ tm.rotation = tm.rotationX = 0;
3449
+ } else if (zFlip && yFlip) {
3450
+ tm.rotation = tm.rotationY = 0;
3451
+ } else if (yFlip && xFlip) {
3452
+ tm.rotationY = tm.rotationX = 0;
3453
+ }
3454
+
3455
+ tm.scaleX = ((Math.sqrt(a11 * a11 + a21 * a21) * rnd + 0.5) | 0) / rnd;
3456
+ tm.scaleY = ((Math.sqrt(a22 * a22 + a23 * a23) * rnd + 0.5) | 0) / rnd;
3457
+ tm.scaleZ = ((Math.sqrt(a32 * a32 + a33 * a33) * rnd + 0.5) | 0) / rnd;
3458
+ tm.skewX = 0;
3459
+ tm.perspective = a43 ? 1 / ((a43 < 0) ? -a43 : a43) : 0;
3460
+ tm.x = a14;
3461
+ tm.y = a24;
3462
+ tm.z = a34;
3398
3463
  }
3399
3464
 
3400
- tm.scaleX = ((Math.sqrt(a11 * a11 + a21 * a21) * rnd + 0.5) | 0) / rnd;
3401
- tm.scaleY = ((Math.sqrt(a22 * a22 + a23 * a23) * rnd + 0.5) | 0) / rnd;
3402
- tm.scaleZ = ((Math.sqrt(a32 * a32 + a33 * a33) * rnd + 0.5) | 0) / rnd;
3403
- tm.skewX = 0;
3404
- tm.perspective = a43 ? 1 / ((a43 < 0) ? -a43 : a43) : 0;
3405
- tm.x = a14;
3406
- tm.y = a24;
3407
- tm.z = a34;
3408
- }
3409
-
3410
- } 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.
3411
- var k = (m.length >= 6),
3412
- a = k ? m[0] : 1,
3413
- b = m[1] || 0,
3414
- c = m[2] || 0,
3415
- d = k ? m[3] : 1;
3416
- tm.x = m[4] || 0;
3417
- tm.y = m[5] || 0;
3418
- scaleX = Math.sqrt(a * a + b * b);
3419
- scaleY = Math.sqrt(d * d + c * c);
3420
- rotation = (a || b) ? Math.atan2(b, a) * _RAD2DEG : tm.rotation || 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist).
3421
- skewX = (c || d) ? Math.atan2(c, d) * _RAD2DEG + rotation : tm.skewX || 0;
3422
- difX = scaleX - Math.abs(tm.scaleX || 0);
3423
- difY = scaleY - Math.abs(tm.scaleY || 0);
3424
- if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) {
3425
- if (invX) {
3426
- scaleX *= -1;
3427
- skewX += (rotation <= 0) ? 180 : -180;
3428
- rotation += (rotation <= 0) ? 180 : -180;
3429
- } else {
3430
- scaleY *= -1;
3431
- skewX += (skewX <= 0) ? 180 : -180;
3465
+ } 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.
3466
+ var k = (m.length >= 6),
3467
+ a = k ? m[0] : 1,
3468
+ b = m[1] || 0,
3469
+ c = m[2] || 0,
3470
+ d = k ? m[3] : 1;
3471
+ tm.x = m[4] || 0;
3472
+ tm.y = m[5] || 0;
3473
+ scaleX = Math.sqrt(a * a + b * b);
3474
+ scaleY = Math.sqrt(d * d + c * c);
3475
+ rotation = (a || b) ? Math.atan2(b, a) * _RAD2DEG : tm.rotation || 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist).
3476
+ skewX = (c || d) ? Math.atan2(c, d) * _RAD2DEG + rotation : tm.skewX || 0;
3477
+ difX = scaleX - Math.abs(tm.scaleX || 0);
3478
+ difY = scaleY - Math.abs(tm.scaleY || 0);
3479
+ if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) {
3480
+ if (invX) {
3481
+ scaleX *= -1;
3482
+ skewX += (rotation <= 0) ? 180 : -180;
3483
+ rotation += (rotation <= 0) ? 180 : -180;
3484
+ } else {
3485
+ scaleY *= -1;
3486
+ skewX += (skewX <= 0) ? 180 : -180;
3487
+ }
3488
+ }
3489
+ difR = (rotation - tm.rotation) % 180; //note: matching ranges would be very small (+/-0.0001) or very close to 180.
3490
+ difS = (skewX - tm.skewX) % 180;
3491
+ //if there's already a recorded _gsTransform in place for the target, we should leave those values in place unless we know things changed for sure (beyond a super small amount). This gets around ambiguous interpretations, like if scaleX and scaleY are both -1, the matrix would be the same as if the rotation was 180 with normal scaleX/scaleY. If the user tweened to particular values, those must be prioritized to ensure animation is consistent.
3492
+ if (tm.skewX === undefined || difX > min || difX < -min || difY > min || difY < -min || (difR > -minAngle && difR < minAngle && (difR * rnd) | 0 !== 0) || (difS > -minAngle && difS < minAngle && (difS * rnd) | 0 !== 0)) {
3493
+ tm.scaleX = scaleX;
3494
+ tm.scaleY = scaleY;
3495
+ tm.rotation = rotation;
3496
+ tm.skewX = skewX;
3497
+ }
3498
+ if (_supports3D) {
3499
+ tm.rotationX = tm.rotationY = tm.z = 0;
3500
+ tm.perspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0;
3501
+ tm.scaleZ = 1;
3432
3502
  }
3433
3503
  }
3434
- difR = (rotation - tm.rotation) % 180; //note: matching ranges would be very small (+/-0.0001) or very close to 180.
3435
- difS = (skewX - tm.skewX) % 180;
3436
- //if there's already a recorded _gsTransform in place for the target, we should leave those values in place unless we know things changed for sure (beyond a super small amount). This gets around ambiguous interpretations, like if scaleX and scaleY are both -1, the matrix would be the same as if the rotation was 180 with normal scaleX/scaleY. If the user tweened to particular values, those must be prioritized to ensure animation is consistent.
3437
- if (tm.skewX === undefined || difX > min || difX < -min || difY > min || difY < -min || (difR > -minAngle && difR < minAngle && (difR * rnd) | 0 !== 0) || (difS > -minAngle && difS < minAngle && (difS * rnd) | 0 !== 0)) {
3438
- tm.scaleX = scaleX;
3439
- tm.scaleY = scaleY;
3440
- tm.rotation = rotation;
3441
- tm.skewX = skewX;
3442
- }
3443
- if (_supports3D) {
3444
- tm.rotationX = tm.rotationY = tm.z = 0;
3445
- tm.perspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0;
3446
- tm.scaleZ = 1;
3447
- }
3448
- }
3449
- tm.zOrigin = zOrigin;
3504
+ tm.zOrigin = zOrigin;
3450
3505
 
3451
- //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.
3452
- for (i in tm) {
3453
- if (tm[i] < min) if (tm[i] > -min) {
3454
- tm[i] = 0;
3506
+ //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.
3507
+ for (i in tm) {
3508
+ if (tm[i] < min) if (tm[i] > -min) {
3509
+ tm[i] = 0;
3510
+ }
3455
3511
  }
3456
3512
  }
3457
3513
  //DEBUG: _log("parsed rotation: "+(tm.rotationX)+", "+(tm.rotationY)+", "+(tm.rotation)+", scale: "+tm.scaleX+", "+tm.scaleY+", "+tm.scaleZ+", position: "+tm.x+", "+tm.y+", "+tm.z+", perspective: "+tm.perspective);
3458
3514
  if (rec) {
3459
3515
  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)
3460
3516
  }
3517
+ tm.xPercent = tm.yPercent = 0;
3461
3518
  return tm;
3462
3519
  },
3463
3520
 
@@ -3486,8 +3543,8 @@
3486
3543
  h = this.t.offsetHeight,
3487
3544
  clip = (cs.position !== "absolute"),
3488
3545
  m = "progid:DXImageTransform.Microsoft.Matrix(M11=" + a + ", M12=" + b + ", M21=" + c + ", M22=" + d,
3489
- ox = t.x,
3490
- oy = t.y,
3546
+ ox = t.x + (w * t.xPercent / 100),
3547
+ oy = t.y + (h * t.yPercent / 100),
3491
3548
  dx, dy;
3492
3549
 
3493
3550
  //if transformOrigin is being used, adjust the offset x and y
@@ -3547,10 +3604,13 @@
3547
3604
  sx = t.scaleX,
3548
3605
  sy = t.scaleY,
3549
3606
  sz = t.scaleZ,
3607
+ x = t.x,
3608
+ y = t.y,
3609
+ z = t.z,
3550
3610
  perspective = t.perspective,
3551
3611
  a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43,
3552
3612
  zOrigin, rnd, cos, sin, t1, t2, t3, t4;
3553
- if (v === 1 || v === 0) if (t.force3D === "auto") if (!t.rotationY && !t.rotationX && sz === 1 && !perspective && !t.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
3613
+ if (v === 1 || v === 0) if (t.force3D === "auto") 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
3554
3614
  _set2DTransformRatio.call(this, v);
3555
3615
  return;
3556
3616
  }
@@ -3586,7 +3646,7 @@
3586
3646
  a22 = cos;
3587
3647
 
3588
3648
  } else if (!t.rotationY && !t.rotationX && sz === 1 && !perspective) { //if we're only translating and/or 2D scaling, this is faster...
3589
- style[_transformProp] = "translate3d(" + t.x + "px," + t.y + "px," + t.z +"px)" + ((sx !== 1 || sy !== 1) ? " scale(" + sx + "," + sy + ")" : "");
3649
+ style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) translate3d(" : "translate3d(") + x + "px," + y + "px," + z +"px)" + ((sx !== 1 || sy !== 1) ? " scale(" + sx + "," + sy + ")" : "");
3590
3650
  return;
3591
3651
  } else {
3592
3652
  a11 = a22 = 1;
@@ -3652,24 +3712,28 @@
3652
3712
  a34 = a33*a34+zOrigin;
3653
3713
  }
3654
3714
  //we round the x, y, and z slightly differently to allow even larger values.
3655
- a14 = (t1 = (a14 += t.x) - (a14 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a14 : a14;
3656
- a24 = (t1 = (a24 += t.y) - (a24 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a24 : a24;
3657
- a34 = (t1 = (a34 += t.z) - (a34 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a34 : a34;
3658
- style[_transformProp] = "matrix3d(" + [ (((a11 * rnd) | 0) / rnd), (((a21 * rnd) | 0) / rnd), (((a31 * rnd) | 0) / rnd), (((a41 * rnd) | 0) / rnd), (((a12 * rnd) | 0) / rnd), (((a22 * rnd) | 0) / rnd), (((a32 * rnd) | 0) / rnd), (((a42 * rnd) | 0) / rnd), (((a13 * rnd) | 0) / rnd), (((a23 * rnd) | 0) / rnd), (((a33 * rnd) | 0) / rnd), (((a43 * rnd) | 0) / rnd), a14, a24, a34, (perspective ? (1 + (-a34 / perspective)) : 1) ].join(",") + ")";
3715
+ a14 = (t1 = (a14 += x) - (a14 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a14 : a14;
3716
+ a24 = (t1 = (a24 += y) - (a24 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a24 : a24;
3717
+ a34 = (t1 = (a34 += z) - (a34 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a34 : a34;
3718
+ style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix3d(" : "matrix3d(") + [ (((a11 * rnd) | 0) / rnd), (((a21 * rnd) | 0) / rnd), (((a31 * rnd) | 0) / rnd), (((a41 * rnd) | 0) / rnd), (((a12 * rnd) | 0) / rnd), (((a22 * rnd) | 0) / rnd), (((a32 * rnd) | 0) / rnd), (((a42 * rnd) | 0) / rnd), (((a13 * rnd) | 0) / rnd), (((a23 * rnd) | 0) / rnd), (((a33 * rnd) | 0) / rnd), (((a43 * rnd) | 0) / rnd), a14, a24, a34, (perspective ? (1 + (-a34 / perspective)) : 1) ].join(",") + ")";
3659
3719
  },
3660
3720
 
3661
3721
  _set2DTransformRatio = _internals.set2DTransformRatio = function(v) {
3662
3722
  var t = this.data, //refers to the element's _gsTransform object
3663
3723
  targ = this.t,
3664
3724
  style = targ.style,
3725
+ x = t.x,
3726
+ y = t.y,
3727
+ prefix = "",
3665
3728
  ang, skew, rnd, sx, sy;
3666
3729
  if (t.rotationX || t.rotationY || t.z || t.force3D === true || (t.force3D === "auto" && v !== 1 && v !== 0)) { //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.
3667
3730
  this.setRatio = _set3DTransformRatio;
3668
3731
  _set3DTransformRatio.call(this, v);
3669
3732
  return;
3670
3733
  }
3734
+
3671
3735
  if (!t.rotation && !t.skewX) {
3672
- style[_transformProp] = "matrix(" + t.scaleX + ",0,0," + t.scaleY + "," + t.x + "," + t.y + ")";
3736
+ style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + t.scaleX + ",0,0," + t.scaleY + "," + x + "," + y + ")";
3673
3737
  } else {
3674
3738
  ang = t.rotation * _DEG2RAD;
3675
3739
  skew = ang - t.skewX * _DEG2RAD;
@@ -3677,11 +3741,11 @@
3677
3741
  sx = t.scaleX * rnd;
3678
3742
  sy = t.scaleY * rnd;
3679
3743
  //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 5 decimal places.
3680
- style[_transformProp] = "matrix(" + (((Math.cos(ang) * sx) | 0) / rnd) + "," + (((Math.sin(ang) * sx) | 0) / rnd) + "," + (((Math.sin(skew) * -sy) | 0) / rnd) + "," + (((Math.cos(skew) * sy) | 0) / rnd) + "," + t.x + "," + t.y + ")";
3744
+ style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + (((Math.cos(ang) * sx) | 0) / rnd) + "," + (((Math.sin(ang) * sx) | 0) / rnd) + "," + (((Math.sin(skew) * -sy) | 0) / rnd) + "," + (((Math.cos(skew) * sy) | 0) / rnd) + "," + x + "," + y + ")";
3681
3745
  }
3682
3746
  };
3683
3747
 
3684
- _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", {parser:function(t, e, p, cssp, pt, plugin, vars) {
3748
+ _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) {
3685
3749
  if (cssp._transform) { return pt; } //only need to parse the transform once, and only if the browser supports it.
3686
3750
  var m1 = cssp._transform = _getTransform(t, _cs, true, vars.parseTransform),
3687
3751
  style = t.style,
@@ -3705,6 +3769,8 @@
3705
3769
  x:_parseVal(v.x, m1.x),
3706
3770
  y:_parseVal(v.y, m1.y),
3707
3771
  z:_parseVal(v.z, m1.z),
3772
+ xPercent:_parseVal(v.xPercent, m1.xPercent),
3773
+ yPercent:_parseVal(v.yPercent, m1.yPercent),
3708
3774
  perspective:_parseVal(v.transformPerspective, m1.perspective)};
3709
3775
  dr = v.directionalRotation;
3710
3776
  if (dr != null) {
@@ -3716,6 +3782,15 @@
3716
3782
  v.rotation = dr;
3717
3783
  }
3718
3784
  }
3785
+ if (typeof(v.x) === "string" && v.x.indexOf("%") !== -1) {
3786
+ m2.x = 0;
3787
+ m2.xPercent = _parseVal(v.x, m1.xPercent);
3788
+ }
3789
+ if (typeof(v.y) === "string" && v.y.indexOf("%") !== -1) {
3790
+ m2.y = 0;
3791
+ m2.yPercent = _parseVal(v.y, m1.yPercent);
3792
+ }
3793
+
3719
3794
  m2.rotation = _parseAngle(("rotation" in v) ? v.rotation : ("shortRotation" in v) ? v.shortRotation + "_short" : ("rotationZ" in v) ? v.rotationZ : m1.rotation, m1.rotation, "rotation", endRotations);
3720
3795
  if (_supports3D) {
3721
3796
  m2.rotationX = _parseAngle(("rotationX" in v) ? v.rotationX : ("shortRotationX" in v) ? v.shortRotationX + "_short" : m1.rotationX || 0, m1.rotationX, "rotationX", endRotations);
@@ -4546,7 +4621,7 @@
4546
4621
  */
4547
4622
  (function() {
4548
4623
 
4549
- var RoundPropsPlugin = window._gsDefine.plugin({
4624
+ var RoundPropsPlugin = _gsScope._gsDefine.plugin({
4550
4625
  propName: "roundProps",
4551
4626
  priority: -1,
4552
4627
  API: 2,
@@ -4619,10 +4694,10 @@
4619
4694
  * AttrPlugin
4620
4695
  * ----------------------------------------------------------------
4621
4696
  */
4622
- window._gsDefine.plugin({
4697
+ _gsScope._gsDefine.plugin({
4623
4698
  propName: "attr",
4624
4699
  API: 2,
4625
- version: "0.3.2",
4700
+ version: "0.3.3",
4626
4701
 
4627
4702
  //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
4628
4703
  init: function(target, value, tween) {
@@ -4672,10 +4747,10 @@
4672
4747
  * DirectionalRotationPlugin
4673
4748
  * ----------------------------------------------------------------
4674
4749
  */
4675
- window._gsDefine.plugin({
4750
+ _gsScope._gsDefine.plugin({
4676
4751
  propName: "directionalRotation",
4752
+ version: "0.2.1",
4677
4753
  API: 2,
4678
- version: "0.2.0",
4679
4754
 
4680
4755
  //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
4681
4756
  init: function(target, value, tween) {
@@ -4751,9 +4826,9 @@
4751
4826
  * EasePack
4752
4827
  * ----------------------------------------------------------------
4753
4828
  */
4754
- window._gsDefine("easing.Back", ["easing.Ease"], function(Ease) {
4829
+ _gsScope._gsDefine("easing.Back", ["easing.Ease"], function(Ease) {
4755
4830
 
4756
- var w = (window.GreenSockGlobals || window),
4831
+ var w = (_gsScope.GreenSockGlobals || _gsScope),
4757
4832
  gs = w.com.greensock,
4758
4833
  _2PI = Math.PI * 2,
4759
4834
  _HALF_PI = Math.PI / 2,
@@ -5079,7 +5154,9 @@
5079
5154
  }, true);
5080
5155
 
5081
5156
 
5082
- });
5157
+ });
5158
+
5159
+ if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); } //necessary in case TweenLite was already loaded separately.
5083
5160
 
5084
5161
 
5085
5162
 
@@ -5096,10 +5173,10 @@
5096
5173
  * Base classes like TweenLite, SimpleTimeline, Ease, Ticker, etc.
5097
5174
  * ----------------------------------------------------------------
5098
5175
  */
5099
- (function(window) {
5176
+ (function(window, moduleName) {
5100
5177
 
5101
5178
  "use strict";
5102
- var _globals = window.GreenSockGlobals || window;
5179
+ var _globals = window.GreenSockGlobals = window.GreenSockGlobals || window;
5103
5180
  if (_globals.TweenLite) {
5104
5181
  return; //in case the core set of classes is already loaded, don't instantiate twice.
5105
5182
  }
@@ -5113,7 +5190,13 @@
5113
5190
  },
5114
5191
  gs = _namespace("com.greensock"),
5115
5192
  _tinyNum = 0.0000000001,
5116
- _slice = [].slice,
5193
+ _slice = function(a) { //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll()
5194
+ var b = [],
5195
+ l = a.length,
5196
+ i;
5197
+ for (i = 0; i !== l; b.push(a[i++]));
5198
+ return b;
5199
+ },
5117
5200
  _emptyFunc = function() {},
5118
5201
  _isArray = (function() { //works around issues in iframe environments where the Array global isn't shared, thus if the object originates in a different window/iframe, "(obj instanceof Array)" will evaluate false. We added some speed optimizations to avoid Object.prototype.toString.call() unless it's absolutely necessary because it's VERY slow (like 20x slower)
5119
5202
  var toString = Object.prototype.toString,
@@ -5145,7 +5228,7 @@
5145
5228
  * </script>
5146
5229
  * <script src="js/greensock/v1.7/TweenMax.js"></script>
5147
5230
  * <script>
5148
- * window.GreenSockGlobals = null; //reset it back to null so that the next load of TweenMax affects the window and we can reference things directly like TweenLite.to(...)
5231
+ * window.GreenSockGlobals = window._gsQueue = null; //reset it back to null (along with the special _gsQueue variable) so that the next load of TweenMax affects the window and we can reference things directly like TweenLite.to(...)
5149
5232
  * </script>
5150
5233
  * <script src="js/greensock/v1.6/TweenMax.js"></script>
5151
5234
  * <script>
@@ -5185,8 +5268,8 @@
5185
5268
  if (global) {
5186
5269
  _globals[n] = cl; //provides a way to avoid global namespace pollution. By default, the main classes like TweenLite, Power1, Strong, etc. are added to window unless a GreenSockGlobals is defined. So if you want to have things added to a custom object instead, just do something like window.GreenSockGlobals = {} before loading any GreenSock files. You can even set up an alias like window.GreenSockGlobals = windows.gs = {} so that you can access everything like gs.TweenLite. Also remember that ALL classes are added to the window.com.greensock object (in their respective packages, like com.greensock.easing.Power1, com.greensock.TweenLite, etc.)
5187
5270
  if (typeof(define) === "function" && define.amd){ //AMD
5188
- define((window.GreenSockAMDPath ? window.GreenSockAMDPath + "/" : "") + ns.split(".").join("/"), [], function() { return cl; });
5189
- } else if (typeof(module) !== "undefined" && module.exports){ //node
5271
+ define((window.GreenSockAMDPath ? window.GreenSockAMDPath + "/" : "") + ns.split(".").pop(), [], function() { return cl; });
5272
+ } else if (ns === moduleName && typeof(module) !== "undefined" && module.exports){ //node
5190
5273
  module.exports = cl;
5191
5274
  }
5192
5275
  }
@@ -5847,7 +5930,6 @@
5847
5930
  if (!skipDisable) {
5848
5931
  tween._enabled(false, true);
5849
5932
  }
5850
- tween.timeline = null;
5851
5933
 
5852
5934
  if (tween._prev) {
5853
5935
  tween._prev._next = tween._next;
@@ -5859,6 +5941,7 @@
5859
5941
  } else if (this._last === tween) {
5860
5942
  this._last = tween._prev;
5861
5943
  }
5944
+ tween._next = tween._prev = tween.timeline = null;
5862
5945
 
5863
5946
  if (this._timeline) {
5864
5947
  this._uncache(true);
@@ -5913,7 +5996,7 @@
5913
5996
  this._overwrite = overwrite = (overwrite == null) ? _overwriteLookup[TweenLite.defaultOverwrite] : (typeof(overwrite) === "number") ? overwrite >> 0 : _overwriteLookup[overwrite];
5914
5997
 
5915
5998
  if ((isSelector || target instanceof Array || (target.push && _isArray(target))) && typeof(target[0]) !== "number") {
5916
- this._targets = targets = _slice.call(target, 0);
5999
+ this._targets = targets = _slice(target); //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll()
5917
6000
  this._propLookup = [];
5918
6001
  this._siblings = [];
5919
6002
  for (i = 0; i < targets.length; i++) {
@@ -5929,7 +6012,7 @@
5929
6012
  continue;
5930
6013
  } else if (targ.length && targ !== window && targ[0] && (targ[0] === window || (targ[0].nodeType && targ[0].style && !targ.nodeType))) { //in case the user is passing in an array of selector objects (like jQuery objects), we need to check one more level and pull things out if necessary. Also note that <select> elements pass all the criteria regarding length and the first child having style, so we must also check to ensure the target isn't an HTML node itself.
5931
6014
  targets.splice(i--, 1);
5932
- this._targets = targets = targets.concat(_slice.call(targ, 0));
6015
+ this._targets = targets = targets.concat(_slice(targ));
5933
6016
  continue;
5934
6017
  }
5935
6018
  this._siblings[i] = _register(targ, this, false);
@@ -5975,7 +6058,7 @@
5975
6058
  p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
5976
6059
  p._notifyPluginsOfEnabled = p._lazy = false;
5977
6060
 
5978
- TweenLite.version = "1.12.1";
6061
+ TweenLite.version = "1.13.1";
5979
6062
  TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
5980
6063
  TweenLite.defaultOverwrite = "auto";
5981
6064
  TweenLite.ticker = _ticker;
@@ -5983,7 +6066,15 @@
5983
6066
  TweenLite.lagSmoothing = function(threshold, adjustedLag) {
5984
6067
  _ticker.lagSmoothing(threshold, adjustedLag);
5985
6068
  };
5986
- 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; };
6069
+
6070
+ TweenLite.selector = window.$ || window.jQuery || function(e) {
6071
+ var selector = window.$ || window.jQuery;
6072
+ if (selector) {
6073
+ TweenLite.selector = selector;
6074
+ return selector(e);
6075
+ }
6076
+ return (typeof(document) === "undefined") ? e : (document.querySelectorAll ? document.querySelectorAll(e) : document.getElementById((e.charAt(0) === "#") ? e.substr(1) : e));
6077
+ };
5987
6078
 
5988
6079
  var _lazyTweens = [],
5989
6080
  _lazyLookup = {},
@@ -5995,7 +6086,7 @@
5995
6086
  _overwriteLookup = {none:0, all:1, auto:2, concurrent:3, allOnStart:4, preexisting:5, "true":1, "false":0},
5996
6087
  _rootFramesTimeline = Animation._rootFramesTimeline = new SimpleTimeline(),
5997
6088
  _rootTimeline = Animation._rootTimeline = new SimpleTimeline(),
5998
- _lazyRender = function() {
6089
+ _lazyRender = _internals.lazyRender = function() {
5999
6090
  var i = _lazyTweens.length;
6000
6091
  _lazyLookup = {};
6001
6092
  while (--i > -1) {
@@ -6193,12 +6284,9 @@
6193
6284
  }
6194
6285
  }
6195
6286
  }
6196
- if (!ease) {
6197
- this._ease = TweenLite.defaultEase;
6198
- } else if (ease instanceof Ease) {
6199
- this._ease = (v.easeParams instanceof Array) ? ease.config.apply(ease, v.easeParams) : ease;
6200
- } else {
6201
- this._ease = (typeof(ease) === "function") ? new Ease(ease, v.easeParams) : _easeMap[ease] || TweenLite.defaultEase;
6287
+ this._ease = ease = (!ease) ? TweenLite.defaultEase : (ease instanceof Ease) ? ease : (typeof(ease) === "function") ? new Ease(ease, v.easeParams) : _easeMap[ease] || TweenLite.defaultEase;
6288
+ if (v.easeParams instanceof Array && ease.config) {
6289
+ this._ease = ease.config.apply(ease, v.easeParams);
6202
6290
  }
6203
6291
  this._easeType = this._ease._type;
6204
6292
  this._easePower = this._ease._power;
@@ -6397,7 +6485,7 @@
6397
6485
  this.ratio = this._ease.getRatio((this._time === 0) ? 0 : 1);
6398
6486
  }
6399
6487
  }
6400
- 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.
6488
+ if (this._lazy !== false) { //in case a lazy render is pending, we should flush it because the new render is occurring 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.
6401
6489
  this._lazy = false;
6402
6490
  }
6403
6491
  if (!this._active) if (!this._paused && this._time !== prevTime && time >= 0) {
@@ -6415,7 +6503,6 @@
6415
6503
  this.vars.onStart.apply(this.vars.onStartScope || this, this.vars.onStartParams || _blankArray);
6416
6504
  }
6417
6505
  }
6418
-
6419
6506
  pt = this._firstPT;
6420
6507
  while (pt) {
6421
6508
  if (pt.f) {
@@ -6435,7 +6522,7 @@
6435
6522
  }
6436
6523
  }
6437
6524
 
6438
- if (callback) if (!this._gc) { //check _gc because there's a chance that kill() could be called in an onUpdate
6525
+ if (callback) if (!this._gc || force) { //check _gc because there's a chance that kill() could be called in an onUpdate
6439
6526
  if (time < 0 && this._startAt && !this._onUpdate && 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.
6440
6527
  this._startAt.render(time, suppressEvents, force);
6441
6528
  }
@@ -6452,7 +6539,6 @@
6452
6539
  this._rawPrevTime = 0;
6453
6540
  }
6454
6541
  }
6455
-
6456
6542
  };
6457
6543
 
6458
6544
  p._kill = function(vars, target) {
@@ -6808,4 +6894,4 @@
6808
6894
 
6809
6895
  _tickerActive = false; //ensures that the first official animation forces a ticker.tick() to update the time when it is instantiated
6810
6896
 
6811
- })(window);
6897
+ })((typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window, "TweenMax");