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: beta 1.9.3
3
- * DATE: 2013-04-02
2
+ * VERSION: beta 1.9.4
3
+ * DATE: 2014-07-17
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
@@ -9,13 +9,14 @@
9
9
  *
10
10
  * @author: Jack Doyle, jack@greensock.com
11
11
  **/
12
- (window._gsQueue || (window._gsQueue = [])).push( function() {
12
+ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node
13
+ (_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() {
13
14
 
14
15
  "use strict";
15
16
 
16
- window._gsDefine("easing.Back", ["easing.Ease"], function(Ease) {
17
+ _gsScope._gsDefine("easing.Back", ["easing.Ease"], function(Ease) {
17
18
 
18
- var w = (window.GreenSockGlobals || window),
19
+ var w = (_gsScope.GreenSockGlobals || _gsScope),
19
20
  gs = w.com.greensock,
20
21
  _2PI = Math.PI * 2,
21
22
  _HALF_PI = Math.PI / 2,
@@ -340,4 +341,4 @@
340
341
 
341
342
  }, true);
342
343
 
343
- }); if (window._gsDefine) { window._gsQueue.pop()(); }
344
+ }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 0.1.8
3
- * DATE: 2014-06-21
2
+ * VERSION: 0.1.9
3
+ * DATE: 2014-07-22
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com/jquery-gsap-plugin/
5
5
  *
6
6
  * Requires TweenLite version 1.8.0 or higher and CSSPlugin.
@@ -139,7 +139,7 @@
139
139
  obj.queue(config.queue, doAnimation); //note: the queued function will get called once for each element in the jQuery collection.
140
140
  if (typeof(config.old) === "function") {
141
141
  obj.queue(config.queue, function(next) {
142
- config.old();
142
+ config.old.call(this);
143
143
  next();
144
144
  });
145
145
  }
@@ -170,6 +170,6 @@
170
170
  return this;
171
171
  };
172
172
 
173
- $.gsap = {enabled:function(value) {_enabled = value;}, version:"0.1.8"};
173
+ $.gsap = {enabled:function(value) {_enabled = value;}, version:"0.1.9"};
174
174
 
175
175
  }(jQuery));
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 0.3.2
3
- * DATE: 2014-05-23
2
+ * VERSION: 0.3.3
3
+ * DATE: 2014-07-17
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
@@ -9,14 +9,15 @@
9
9
  *
10
10
  * @author: Jack Doyle, jack@greensock.com
11
11
  */
12
- (window._gsQueue || (window._gsQueue = [])).push( function() {
12
+ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node
13
+ (_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() {
13
14
 
14
15
  "use strict";
15
16
 
16
- window._gsDefine.plugin({
17
+ _gsScope._gsDefine.plugin({
17
18
  propName: "attr",
18
19
  API: 2,
19
- version: "0.3.2",
20
+ version: "0.3.3",
20
21
 
21
22
  //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
22
23
  init: function(target, value, tween) {
@@ -52,4 +53,4 @@
52
53
 
53
54
  });
54
55
 
55
- }); if (window._gsDefine) { window._gsQueue.pop()(); }
56
+ }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: beta 1.3.2
3
- * DATE: 2014-04-08
2
+ * VERSION: beta 1.3.3
3
+ * DATE: 2014-07-17
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
@@ -9,7 +9,8 @@
9
9
  *
10
10
  * @author: Jack Doyle, jack@greensock.com
11
11
  **/
12
- (window._gsQueue || (window._gsQueue = [])).push( function() {
12
+ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node
13
+ (_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() {
13
14
 
14
15
  "use strict";
15
16
 
@@ -303,10 +304,10 @@
303
304
 
304
305
 
305
306
 
306
- BezierPlugin = window._gsDefine.plugin({
307
+ BezierPlugin = _gsScope._gsDefine.plugin({
307
308
  propName: "bezier",
308
309
  priority: -1,
309
- version: "1.3.2",
310
+ version: "1.3.3",
310
311
  API: 2,
311
312
  global:true,
312
313
 
@@ -498,7 +499,7 @@
498
499
  };
499
500
 
500
501
  BezierPlugin._cssRegister = function() {
501
- var CSSPlugin = window._gsDefine.globals.CSSPlugin;
502
+ var CSSPlugin = _gsScope._gsDefine.globals.CSSPlugin;
502
503
  if (!CSSPlugin) {
503
504
  return;
504
505
  }
@@ -577,4 +578,18 @@
577
578
  return this._super._kill.call(this, lookup);
578
579
  };
579
580
 
580
- }); if (window._gsDefine) { window._gsQueue.pop()(); }
581
+ }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
582
+
583
+ //export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date)
584
+ (function(name) {
585
+ "use strict";
586
+ var getGlobal = function() {
587
+ return (_gsScope.GreenSockGlobals || _gsScope)[name];
588
+ };
589
+ if (typeof(define) === "function" && define.amd) { //AMD
590
+ define(["TweenLite"], getGlobal);
591
+ } else if (typeof(module) !== "undefined" && module.exports) { //node
592
+ require("../TweenLite.js");
593
+ module.exports = getGlobal();
594
+ }
595
+ }("BezierPlugin"));
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.12.1
3
- * DATE: 2014-06-26
2
+ * VERSION: 1.13.0
3
+ * DATE: 2014-07-17
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
@@ -9,11 +9,12 @@
9
9
  *
10
10
  * @author: Jack Doyle, jack@greensock.com
11
11
  */
12
- (window._gsQueue || (window._gsQueue = [])).push( function() {
12
+ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node
13
+ (_gsScope._gsQueue || (_gsScope._gsQueue = [])).push( function() {
13
14
 
14
15
  "use strict";
15
16
 
16
- window._gsDefine("plugins.CSSPlugin", ["plugins.TweenPlugin","TweenLite"], function(TweenPlugin, TweenLite) {
17
+ _gsScope._gsDefine("plugins.CSSPlugin", ["plugins.TweenPlugin","TweenLite"], function(TweenPlugin, TweenLite) {
17
18
 
18
19
  /** @constructor **/
19
20
  var CSSPlugin = function() {
@@ -29,7 +30,7 @@
29
30
  p = CSSPlugin.prototype = new TweenPlugin("css");
30
31
 
31
32
  p.constructor = CSSPlugin;
32
- CSSPlugin.version = "1.12.1";
33
+ CSSPlugin.version = "1.13.0";
33
34
  CSSPlugin.API = 2;
34
35
  CSSPlugin.defaultTransformPerspective = 0;
35
36
  CSSPlugin.defaultSkewType = "compensated";
@@ -932,7 +933,7 @@
932
933
  if (!_specialProps[p]) {
933
934
  var pluginName = p.charAt(0).toUpperCase() + p.substr(1) + "Plugin";
934
935
  _registerComplexSpecialProp(p, {parser:function(t, e, p, cssp, pt, plugin, vars) {
935
- var pluginClass = (window.GreenSockGlobals || window).com.greensock.plugins[pluginName];
936
+ var pluginClass = (_gsScope.GreenSockGlobals || _gsScope).com.greensock.plugins[pluginName];
936
937
  if (!pluginClass) {
937
938
  _log("Error: " + pluginName + " js file not loaded.");
938
939
  return pt;
@@ -1047,7 +1048,7 @@
1047
1048
 
1048
1049
 
1049
1050
  //transform-related methods and properties
1050
- var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective").split(","),
1051
+ var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent").split(","),
1051
1052
  _transformProp = _checkPropPrefix("transform"), //the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform.
1052
1053
  _transformPropCSS = _prefixCSS + "transform",
1053
1054
  _transformOriginProp = _checkPropPrefix("transformOrigin"),
@@ -1083,151 +1084,156 @@
1083
1084
  s = t.currentStyle.filter.match(_ieGetMatrixExp);
1084
1085
  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(",") : "";
1085
1086
  }
1086
- //split the matrix values out into an array (m for matrix)
1087
- m = (s || "").match(/(?:\-|\b)[\d\-\.e]+\b/gi) || [];
1088
- i = m.length;
1089
- while (--i > -1) {
1090
- n = Number(m[i]);
1091
- 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).
1092
- }
1093
- if (m.length === 16) {
1087
+ 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).
1088
+ 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};
1089
+ } else {
1090
+ //split the matrix values out into an array (m for matrix)
1091
+ m = (s || "").match(/(?:\-|\b)[\d\-\.e]+\b/gi) || [];
1092
+ i = m.length;
1093
+ while (--i > -1) {
1094
+ n = Number(m[i]);
1095
+ 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).
1096
+ }
1097
+ if (m.length === 16) {
1098
+
1099
+ //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)
1100
+ var a13 = m[8], a23 = m[9], a33 = m[10],
1101
+ a14 = m[12], a24 = m[13], a34 = m[14];
1102
+
1103
+ //we manually compensate for non-zero z component of transformOrigin to work around bugs in Safari
1104
+ if (tm.zOrigin) {
1105
+ a34 = -tm.zOrigin;
1106
+ a14 = a13*a34-m[12];
1107
+ a24 = a23*a34-m[13];
1108
+ a34 = a33*a34+tm.zOrigin-m[14];
1109
+ }
1094
1110
 
1095
- //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)
1096
- var a13 = m[8], a23 = m[9], a33 = m[10],
1097
- a14 = m[12], a24 = m[13], a34 = m[14];
1111
+ //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.
1112
+ if (!rec || parse || tm.rotationX == null) {
1113
+ var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3],
1114
+ a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7],
1115
+ a43 = m[11],
1116
+ angle = Math.atan2(a32, a33),
1117
+ xFlip = (angle < -minPI || angle > minPI),
1118
+ t1, t2, t3, cos, sin, yFlip, zFlip;
1119
+ tm.rotationX = angle * _RAD2DEG;
1120
+ //rotationX
1121
+ if (angle) {
1122
+ cos = Math.cos(-angle);
1123
+ sin = Math.sin(-angle);
1124
+ t1 = a12*cos+a13*sin;
1125
+ t2 = a22*cos+a23*sin;
1126
+ t3 = a32*cos+a33*sin;
1127
+ a13 = a12*-sin+a13*cos;
1128
+ a23 = a22*-sin+a23*cos;
1129
+ a33 = a32*-sin+a33*cos;
1130
+ a43 = a42*-sin+a43*cos;
1131
+ a12 = t1;
1132
+ a22 = t2;
1133
+ a32 = t3;
1134
+ }
1135
+ //rotationY
1136
+ angle = Math.atan2(a13, a11);
1137
+ tm.rotationY = angle * _RAD2DEG;
1138
+ if (angle) {
1139
+ yFlip = (angle < -minPI || angle > minPI);
1140
+ cos = Math.cos(-angle);
1141
+ sin = Math.sin(-angle);
1142
+ t1 = a11*cos-a13*sin;
1143
+ t2 = a21*cos-a23*sin;
1144
+ t3 = a31*cos-a33*sin;
1145
+ a23 = a21*sin+a23*cos;
1146
+ a33 = a31*sin+a33*cos;
1147
+ a43 = a41*sin+a43*cos;
1148
+ a11 = t1;
1149
+ a21 = t2;
1150
+ a31 = t3;
1151
+ }
1152
+ //rotationZ
1153
+ angle = Math.atan2(a21, a22);
1154
+ tm.rotation = angle * _RAD2DEG;
1155
+ if (angle) {
1156
+ zFlip = (angle < -minPI || angle > minPI);
1157
+ cos = Math.cos(-angle);
1158
+ sin = Math.sin(-angle);
1159
+ a11 = a11*cos+a12*sin;
1160
+ t2 = a21*cos+a22*sin;
1161
+ a22 = a21*-sin+a22*cos;
1162
+ a32 = a31*-sin+a32*cos;
1163
+ a21 = t2;
1164
+ }
1098
1165
 
1099
- //we manually compensate for non-zero z component of transformOrigin to work around bugs in Safari
1100
- if (tm.zOrigin) {
1101
- a34 = -tm.zOrigin;
1102
- a14 = a13*a34-m[12];
1103
- a24 = a23*a34-m[13];
1104
- a34 = a33*a34+tm.zOrigin-m[14];
1105
- }
1166
+ if (zFlip && xFlip) {
1167
+ tm.rotation = tm.rotationX = 0;
1168
+ } else if (zFlip && yFlip) {
1169
+ tm.rotation = tm.rotationY = 0;
1170
+ } else if (yFlip && xFlip) {
1171
+ tm.rotationY = tm.rotationX = 0;
1172
+ }
1106
1173
 
1107
- //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.
1108
- if (!rec || parse || tm.rotationX == null) {
1109
- var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3],
1110
- a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7],
1111
- a43 = m[11],
1112
- angle = Math.atan2(a32, a33),
1113
- xFlip = (angle < -minPI || angle > minPI),
1114
- t1, t2, t3, cos, sin, yFlip, zFlip;
1115
- tm.rotationX = angle * _RAD2DEG;
1116
- //rotationX
1117
- if (angle) {
1118
- cos = Math.cos(-angle);
1119
- sin = Math.sin(-angle);
1120
- t1 = a12*cos+a13*sin;
1121
- t2 = a22*cos+a23*sin;
1122
- t3 = a32*cos+a33*sin;
1123
- a13 = a12*-sin+a13*cos;
1124
- a23 = a22*-sin+a23*cos;
1125
- a33 = a32*-sin+a33*cos;
1126
- a43 = a42*-sin+a43*cos;
1127
- a12 = t1;
1128
- a22 = t2;
1129
- a32 = t3;
1174
+ tm.scaleX = ((Math.sqrt(a11 * a11 + a21 * a21) * rnd + 0.5) | 0) / rnd;
1175
+ tm.scaleY = ((Math.sqrt(a22 * a22 + a23 * a23) * rnd + 0.5) | 0) / rnd;
1176
+ tm.scaleZ = ((Math.sqrt(a32 * a32 + a33 * a33) * rnd + 0.5) | 0) / rnd;
1177
+ tm.skewX = 0;
1178
+ tm.perspective = a43 ? 1 / ((a43 < 0) ? -a43 : a43) : 0;
1179
+ tm.x = a14;
1180
+ tm.y = a24;
1181
+ tm.z = a34;
1130
1182
  }
1131
- //rotationY
1132
- angle = Math.atan2(a13, a11);
1133
- tm.rotationY = angle * _RAD2DEG;
1134
- if (angle) {
1135
- yFlip = (angle < -minPI || angle > minPI);
1136
- cos = Math.cos(-angle);
1137
- sin = Math.sin(-angle);
1138
- t1 = a11*cos-a13*sin;
1139
- t2 = a21*cos-a23*sin;
1140
- t3 = a31*cos-a33*sin;
1141
- a23 = a21*sin+a23*cos;
1142
- a33 = a31*sin+a33*cos;
1143
- a43 = a41*sin+a43*cos;
1144
- a11 = t1;
1145
- a21 = t2;
1146
- a31 = t3;
1183
+
1184
+ } 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.
1185
+ var k = (m.length >= 6),
1186
+ a = k ? m[0] : 1,
1187
+ b = m[1] || 0,
1188
+ c = m[2] || 0,
1189
+ d = k ? m[3] : 1;
1190
+ tm.x = m[4] || 0;
1191
+ tm.y = m[5] || 0;
1192
+ scaleX = Math.sqrt(a * a + b * b);
1193
+ scaleY = Math.sqrt(d * d + c * c);
1194
+ 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).
1195
+ skewX = (c || d) ? Math.atan2(c, d) * _RAD2DEG + rotation : tm.skewX || 0;
1196
+ difX = scaleX - Math.abs(tm.scaleX || 0);
1197
+ difY = scaleY - Math.abs(tm.scaleY || 0);
1198
+ if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) {
1199
+ if (invX) {
1200
+ scaleX *= -1;
1201
+ skewX += (rotation <= 0) ? 180 : -180;
1202
+ rotation += (rotation <= 0) ? 180 : -180;
1203
+ } else {
1204
+ scaleY *= -1;
1205
+ skewX += (skewX <= 0) ? 180 : -180;
1206
+ }
1147
1207
  }
1148
- //rotationZ
1149
- angle = Math.atan2(a21, a22);
1150
- tm.rotation = angle * _RAD2DEG;
1151
- if (angle) {
1152
- zFlip = (angle < -minPI || angle > minPI);
1153
- cos = Math.cos(-angle);
1154
- sin = Math.sin(-angle);
1155
- a11 = a11*cos+a12*sin;
1156
- t2 = a21*cos+a22*sin;
1157
- a22 = a21*-sin+a22*cos;
1158
- a32 = a31*-sin+a32*cos;
1159
- a21 = t2;
1208
+ difR = (rotation - tm.rotation) % 180; //note: matching ranges would be very small (+/-0.0001) or very close to 180.
1209
+ difS = (skewX - tm.skewX) % 180;
1210
+ //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.
1211
+ 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)) {
1212
+ tm.scaleX = scaleX;
1213
+ tm.scaleY = scaleY;
1214
+ tm.rotation = rotation;
1215
+ tm.skewX = skewX;
1160
1216
  }
1161
-
1162
- if (zFlip && xFlip) {
1163
- tm.rotation = tm.rotationX = 0;
1164
- } else if (zFlip && yFlip) {
1165
- tm.rotation = tm.rotationY = 0;
1166
- } else if (yFlip && xFlip) {
1167
- tm.rotationY = tm.rotationX = 0;
1217
+ if (_supports3D) {
1218
+ tm.rotationX = tm.rotationY = tm.z = 0;
1219
+ tm.perspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0;
1220
+ tm.scaleZ = 1;
1168
1221
  }
1169
-
1170
- tm.scaleX = ((Math.sqrt(a11 * a11 + a21 * a21) * rnd + 0.5) | 0) / rnd;
1171
- tm.scaleY = ((Math.sqrt(a22 * a22 + a23 * a23) * rnd + 0.5) | 0) / rnd;
1172
- tm.scaleZ = ((Math.sqrt(a32 * a32 + a33 * a33) * rnd + 0.5) | 0) / rnd;
1173
- tm.skewX = 0;
1174
- tm.perspective = a43 ? 1 / ((a43 < 0) ? -a43 : a43) : 0;
1175
- tm.x = a14;
1176
- tm.y = a24;
1177
- tm.z = a34;
1178
1222
  }
1223
+ tm.zOrigin = zOrigin;
1179
1224
 
1180
- } 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.
1181
- var k = (m.length >= 6),
1182
- a = k ? m[0] : 1,
1183
- b = m[1] || 0,
1184
- c = m[2] || 0,
1185
- d = k ? m[3] : 1;
1186
- tm.x = m[4] || 0;
1187
- tm.y = m[5] || 0;
1188
- scaleX = Math.sqrt(a * a + b * b);
1189
- scaleY = Math.sqrt(d * d + c * c);
1190
- 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).
1191
- skewX = (c || d) ? Math.atan2(c, d) * _RAD2DEG + rotation : tm.skewX || 0;
1192
- difX = scaleX - Math.abs(tm.scaleX || 0);
1193
- difY = scaleY - Math.abs(tm.scaleY || 0);
1194
- if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) {
1195
- if (invX) {
1196
- scaleX *= -1;
1197
- skewX += (rotation <= 0) ? 180 : -180;
1198
- rotation += (rotation <= 0) ? 180 : -180;
1199
- } else {
1200
- scaleY *= -1;
1201
- skewX += (skewX <= 0) ? 180 : -180;
1225
+ //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.
1226
+ for (i in tm) {
1227
+ if (tm[i] < min) if (tm[i] > -min) {
1228
+ tm[i] = 0;
1202
1229
  }
1203
1230
  }
1204
- difR = (rotation - tm.rotation) % 180; //note: matching ranges would be very small (+/-0.0001) or very close to 180.
1205
- difS = (skewX - tm.skewX) % 180;
1206
- //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.
1207
- 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)) {
1208
- tm.scaleX = scaleX;
1209
- tm.scaleY = scaleY;
1210
- tm.rotation = rotation;
1211
- tm.skewX = skewX;
1212
- }
1213
- if (_supports3D) {
1214
- tm.rotationX = tm.rotationY = tm.z = 0;
1215
- tm.perspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0;
1216
- tm.scaleZ = 1;
1217
- }
1218
- }
1219
- tm.zOrigin = zOrigin;
1220
-
1221
- //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.
1222
- for (i in tm) {
1223
- if (tm[i] < min) if (tm[i] > -min) {
1224
- tm[i] = 0;
1225
- }
1226
1231
  }
1227
1232
  //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);
1228
1233
  if (rec) {
1229
1234
  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)
1230
1235
  }
1236
+ tm.xPercent = tm.yPercent = 0;
1231
1237
  return tm;
1232
1238
  },
1233
1239
 
@@ -1256,8 +1262,8 @@
1256
1262
  h = this.t.offsetHeight,
1257
1263
  clip = (cs.position !== "absolute"),
1258
1264
  m = "progid:DXImageTransform.Microsoft.Matrix(M11=" + a + ", M12=" + b + ", M21=" + c + ", M22=" + d,
1259
- ox = t.x,
1260
- oy = t.y,
1265
+ ox = t.x + (w * t.xPercent / 100),
1266
+ oy = t.y + (h * t.yPercent / 100),
1261
1267
  dx, dy;
1262
1268
 
1263
1269
  //if transformOrigin is being used, adjust the offset x and y
@@ -1317,10 +1323,13 @@
1317
1323
  sx = t.scaleX,
1318
1324
  sy = t.scaleY,
1319
1325
  sz = t.scaleZ,
1326
+ x = t.x,
1327
+ y = t.y,
1328
+ z = t.z,
1320
1329
  perspective = t.perspective,
1321
1330
  a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43,
1322
1331
  zOrigin, rnd, cos, sin, t1, t2, t3, t4;
1323
- 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
1332
+ 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
1324
1333
  _set2DTransformRatio.call(this, v);
1325
1334
  return;
1326
1335
  }
@@ -1356,7 +1365,7 @@
1356
1365
  a22 = cos;
1357
1366
 
1358
1367
  } else if (!t.rotationY && !t.rotationX && sz === 1 && !perspective) { //if we're only translating and/or 2D scaling, this is faster...
1359
- style[_transformProp] = "translate3d(" + t.x + "px," + t.y + "px," + t.z +"px)" + ((sx !== 1 || sy !== 1) ? " scale(" + sx + "," + sy + ")" : "");
1368
+ 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 + ")" : "");
1360
1369
  return;
1361
1370
  } else {
1362
1371
  a11 = a22 = 1;
@@ -1422,24 +1431,28 @@
1422
1431
  a34 = a33*a34+zOrigin;
1423
1432
  }
1424
1433
  //we round the x, y, and z slightly differently to allow even larger values.
1425
- a14 = (t1 = (a14 += t.x) - (a14 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a14 : a14;
1426
- a24 = (t1 = (a24 += t.y) - (a24 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a24 : a24;
1427
- a34 = (t1 = (a34 += t.z) - (a34 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a34 : a34;
1428
- 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(",") + ")";
1434
+ a14 = (t1 = (a14 += x) - (a14 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a14 : a14;
1435
+ a24 = (t1 = (a24 += y) - (a24 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a24 : a24;
1436
+ a34 = (t1 = (a34 += z) - (a34 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a34 : a34;
1437
+ 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(",") + ")";
1429
1438
  },
1430
1439
 
1431
1440
  _set2DTransformRatio = _internals.set2DTransformRatio = function(v) {
1432
1441
  var t = this.data, //refers to the element's _gsTransform object
1433
1442
  targ = this.t,
1434
1443
  style = targ.style,
1444
+ x = t.x,
1445
+ y = t.y,
1446
+ prefix = "",
1435
1447
  ang, skew, rnd, sx, sy;
1436
1448
  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.
1437
1449
  this.setRatio = _set3DTransformRatio;
1438
1450
  _set3DTransformRatio.call(this, v);
1439
1451
  return;
1440
1452
  }
1453
+
1441
1454
  if (!t.rotation && !t.skewX) {
1442
- style[_transformProp] = "matrix(" + t.scaleX + ",0,0," + t.scaleY + "," + t.x + "," + t.y + ")";
1455
+ style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + t.scaleX + ",0,0," + t.scaleY + "," + x + "," + y + ")";
1443
1456
  } else {
1444
1457
  ang = t.rotation * _DEG2RAD;
1445
1458
  skew = ang - t.skewX * _DEG2RAD;
@@ -1447,11 +1460,11 @@
1447
1460
  sx = t.scaleX * rnd;
1448
1461
  sy = t.scaleY * rnd;
1449
1462
  //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.
1450
- 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 + ")";
1463
+ 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 + ")";
1451
1464
  }
1452
1465
  };
1453
1466
 
1454
- _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) {
1467
+ _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) {
1455
1468
  if (cssp._transform) { return pt; } //only need to parse the transform once, and only if the browser supports it.
1456
1469
  var m1 = cssp._transform = _getTransform(t, _cs, true, vars.parseTransform),
1457
1470
  style = t.style,
@@ -1475,6 +1488,8 @@
1475
1488
  x:_parseVal(v.x, m1.x),
1476
1489
  y:_parseVal(v.y, m1.y),
1477
1490
  z:_parseVal(v.z, m1.z),
1491
+ xPercent:_parseVal(v.xPercent, m1.xPercent),
1492
+ yPercent:_parseVal(v.yPercent, m1.yPercent),
1478
1493
  perspective:_parseVal(v.transformPerspective, m1.perspective)};
1479
1494
  dr = v.directionalRotation;
1480
1495
  if (dr != null) {
@@ -1486,6 +1501,15 @@
1486
1501
  v.rotation = dr;
1487
1502
  }
1488
1503
  }
1504
+ if (typeof(v.x) === "string" && v.x.indexOf("%") !== -1) {
1505
+ m2.x = 0;
1506
+ m2.xPercent = _parseVal(v.x, m1.xPercent);
1507
+ }
1508
+ if (typeof(v.y) === "string" && v.y.indexOf("%") !== -1) {
1509
+ m2.y = 0;
1510
+ m2.yPercent = _parseVal(v.y, m1.yPercent);
1511
+ }
1512
+
1489
1513
  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);
1490
1514
  if (_supports3D) {
1491
1515
  m2.rotationX = _parseAngle(("rotationX" in v) ? v.rotationX : ("shortRotationX" in v) ? v.shortRotationX + "_short" : m1.rotationX || 0, m1.rotationX, "rotationX", endRotations);
@@ -2299,4 +2323,18 @@
2299
2323
 
2300
2324
  }, true);
2301
2325
 
2302
- }); if (window._gsDefine) { window._gsQueue.pop()(); }
2326
+ }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
2327
+
2328
+ //export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date)
2329
+ (function(name) {
2330
+ "use strict";
2331
+ var getGlobal = function() {
2332
+ return (_gsScope.GreenSockGlobals || _gsScope)[name];
2333
+ };
2334
+ if (typeof(define) === "function" && define.amd) { //AMD
2335
+ define(["TweenLite"], getGlobal);
2336
+ } else if (typeof(module) !== "undefined" && module.exports) { //node
2337
+ require("../TweenLite.js");
2338
+ module.exports = getGlobal();
2339
+ }
2340
+ }("CSSPlugin"));