vendor/assets/javascripts/greensock/TweenMax.js in greensock-rails-1.15.0.0 vs vendor/assets/javascripts/greensock/TweenMax.js in greensock-rails-1.15.1.0
- old
+ new
@@ -1,14 +1,14 @@
/*!
- * VERSION: 1.15.0
- * DATE: 2014-12-03
- * UPDATES AND DOCS AT: http://www.greensock.com
+ * VERSION: 1.15.1
+ * DATE: 2015-01-20
+ * UPDATES AND DOCS AT: http://greensock.com
*
* Includes all of the following: TweenLite, TweenMax, TimelineLite, TimelineMax, EasePack, CSSPlugin, RoundPropsPlugin, BezierPlugin, AttrPlugin, DirectionalRotationPlugin
*
- * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
- * This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
+ * @license Copyright (c) 2008-2015, GreenSock. All rights reserved.
+ * This work is subject to the terms at http://greensock.com/standard-license or for
* Club GreenSock members, the software agreement that was issued with your membership.
*
* @author: Jack Doyle, jack@greensock.com
**/
var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(global) !== "undefined") ? global : this || window; //helps ensure compatibility with AMD/RequireJS and CommonJS/Node
@@ -39,11 +39,11 @@
_isSelector = TweenLiteInternals.isSelector,
_isArray = TweenLiteInternals.isArray,
p = TweenMax.prototype = TweenLite.to({}, 0.1, {}),
_blankArray = [];
- TweenMax.version = "1.15.0";
+ TweenMax.version = "1.15.1";
p.constructor = TweenMax;
p.kill()._gc = false;
TweenMax.killTweensOf = TweenMax.killDelayedCallsTo = TweenLite.killTweensOf;
TweenMax.getTweensOf = TweenLite.getTweensOf;
TweenMax.lagSmoothing = TweenLite.lagSmoothing;
@@ -626,10 +626,11 @@
this.add(v.tweens, 0, v.align, v.stagger);
}
},
_tinyNum = 0.0000000001,
TweenLiteInternals = TweenLite._internals,
+ _internals = TimelineLite._internals = {},
_isSelector = TweenLiteInternals.isSelector,
_isArray = TweenLiteInternals.isArray,
_lazyTweens = TweenLiteInternals.lazyTweens,
_lazyRender = TweenLiteInternals.lazyRender,
_blankArray = [],
@@ -639,11 +640,11 @@
for (p in vars) {
copy[p] = vars[p];
}
return copy;
},
- _pauseCallback = function(tween, callback, params, scope) {
+ _pauseCallback = _internals.pauseCallback = function(tween, callback, params, scope) {
var tl = tween._timeline,
time = tl._totalTime;
if ((callback || !this._forcingPlayhead) && tl._rawPrevTime !== tween._startTime) { //if the user calls a method that moves the playhead (like progress() or time()), it should honor that and skip any pauses (although if there's a callback positioned at that pause, it must jump there and make the call to ensure the time is EXACTLY what it is supposed to be, and then proceed to where the playhead is being forced). Otherwise, imagine placing a pause in the middle of a timeline and then doing timeline.progress(0.9) - it would get stuck where the pause is.
tl.pause(tween._startTime);
if (callback) {
@@ -661,11 +662,11 @@
for (i = 0; i !== l; b.push(a[i++]));
return b;
},
p = TimelineLite.prototype = new SimpleTimeline();
- TimelineLite.version = "1.15.0";
+ TimelineLite.version = "1.15.1";
p.constructor = TimelineLite;
p.kill()._gc = p._forcingPlayhead = false;
/* might use later...
//translates a local time inside an animation to the corresponding time on the root/global timeline, factoring in all nesting and timeScales.
@@ -1314,11 +1315,11 @@
_easeNone = new Ease(null, null, 1, 0),
p = TimelineMax.prototype = new TimelineLite();
p.constructor = TimelineMax;
p.kill()._gc = false;
- TimelineMax.version = "1.15.0";
+ TimelineMax.version = "1.15.1";
p.invalidate = function() {
this._yoyo = (this.vars.yoyo === true);
this._repeat = this.vars.repeat || 0;
this._repeatDelay = this.vars.repeatDelay || 0;
@@ -1346,13 +1347,17 @@
}
}
return this;
};
+ p.removePause = function(position) {
+ return this.removeCallback(TimelineLite._internals.pauseCallback, position);
+ };
+
p.tweenTo = function(position, vars) {
vars = vars || {};
- var copy = {ease:_easeNone, overwrite:(vars.delay ? 2 : 1), useFrames:this.usesFrames(), immediateRender:false},//note: set overwrite to 1 (true/all) by default unless there's a delay so that we avoid a racing situation that could happen if, for example, an onmousemove creates the same tweenTo() over and over again.
+ var copy = {ease:_easeNone, useFrames:this.usesFrames(), immediateRender:false},
duration, p, t;
for (p in vars) {
copy[p] = vars[p];
}
copy.time = this._parseTimeOrLabel(position);
@@ -2349,11 +2354,11 @@
_overwriteProps, //alias to the currently instantiating CSSPlugin's _overwriteProps array. We use this closure in order to avoid having to pass a reference around from method to method and aid in minification.
_specialProps = {},
p = CSSPlugin.prototype = new TweenPlugin("css");
p.constructor = CSSPlugin;
- CSSPlugin.version = "1.15.0";
+ CSSPlugin.version = "1.15.1";
CSSPlugin.API = 2;
CSSPlugin.defaultTransformPerspective = 0;
CSSPlugin.defaultSkewType = "compensated";
p = "px"; //we'll reuse the "p" variable to keep file size down
CSSPlugin.suffixMap = {top:p, right:p, bottom:p, left:p, width:p, height:p, fontSize:p, padding:p, margin:p, perspective:p, lineHeight:""};
@@ -2528,16 +2533,12 @@
// @private returns at object containing ALL of the style properties in camelCase and their associated values.
_getAllStyles = function(t, cs) {
var s = {},
i, tr;
if ((cs = cs || _getComputedStyle(t, null))) {
- if ((i = cs.length)) {
- while (--i > -1) {
- s[cs[i].replace(_camelExp, _camelFunc)] = cs.getPropertyValue(cs[i]);
- }
- } else { //Opera behaves differently - cs.length is always 0, so we must do a for...in loop.
- for (i in cs) {
+ for (i in cs) {
+ if (i.indexOf("Transform") === -1 || _transformProp === i) { //Some webkit browsers duplicate transform values, one non-prefixed and one prefixed ("transform" and "WebkitTransform"), so we must weed out the extra one here.
s[i] = cs[i];
}
}
} else if ((cs = t.currentStyle || t.style)) {
for (i in cs) {
@@ -2619,11 +2620,11 @@
}
var a = v.split(" "),
x = (v.indexOf("left") !== -1) ? "0%" : (v.indexOf("right") !== -1) ? "100%" : a[0],
y = (v.indexOf("top") !== -1) ? "0%" : (v.indexOf("bottom") !== -1) ? "100%" : a[1];
if (y == null) {
- y = "0";
+ y = (x === "center") ? "50%" : "0";
} else if (y === "center") {
y = "50%";
}
if (x === "center" || (isNaN(parseFloat(x)) && (x + "").indexOf("=") === -1)) { //remember, the user could flip-flop the values and say "bottom center" or "center bottom", etc. "center" is ambiguous because it could be used to describe horizontal or vertical, hence the isNaN(). If there's an "=" sign in the value, it's relative.
x = "50%";
@@ -2667,19 +2668,20 @@
* @param {Object=} directionalEnd An object that will store the raw end values for directional angles ("_short", "_cw", or "_ccw" suffix). We need a way to store the uncompensated value so that at the end of the tween, we set it to exactly what was requested with no directional compensation.
* @return {number} parsed angle in radians
*/
_parseAngle = function(v, d, p, directionalEnd) {
var min = 0.000001,
- cap, split, dif, result;
+ cap, split, dif, result, isRelative;
if (v == null) {
result = d;
} else if (typeof(v) === "number") {
result = v;
} else {
cap = 360;
split = v.split("_");
- dif = Number(split[0].replace(_NaNExp, "")) * ((v.indexOf("rad") === -1) ? 1 : _RAD2DEG) - ((v.charAt(1) === "=") ? 0 : d);
+ isRelative = (v.charAt(1) === "=");
+ dif = (isRelative ? parseInt(v.charAt(0) + "1", 10) * parseFloat(split[0].substr(2)) : parseFloat(split[0])) * ((v.indexOf("rad") === -1) ? 1 : _RAD2DEG) - (isRelative ? 0 : d);
if (split.length) {
if (directionalEnd) {
directionalEnd[p] = d + dif;
}
if (v.indexOf("short") !== -1) {
@@ -3403,11 +3405,11 @@
svg = _createSVG("svg", _docElement);
rect = _createSVG("rect", svg, {width:100, height:50, x:100});
width = rect.getBoundingClientRect().width;
rect.style[_transformOriginProp] = "50% 50%";
rect.style[_transformProp] = "scaleX(0.5)";
- force = (width === rect.getBoundingClientRect().width);
+ force = (width === rect.getBoundingClientRect().width && !(_isFirefox && _supports3D)); //note: Firefox fails the test even though it does support CSS transforms in 3D. Since we can't push 3D stuff into the transform attribute, we force Firefox to pass the test here (as long as it does truly support 3D).
_docElement.removeChild(svg);
}
return force;
})(),
_parseSVGOrigin = function(e, origin, decoratee) {
@@ -3431,12 +3433,10 @@
}
var tm = rec ? t._gsTransform || new Transform() : new Transform(),
invX = (tm.scaleX < 0), //in order to interpret things properly, we need to know if the user applied a negative scaleX previously so that we can adjust the rotation and skewX accordingly. Otherwise, if we always interpret a flipped matrix as affecting scaleY and the user only wants to tween the scaleX on multiple sequential tweens, it would keep the negative scaleY without that being the user's intent.
min = 0.00002,
rnd = 100000,
- minAngle = 179.99,
- minPI = minAngle * _DEG2RAD,
zOrigin = _supports3D ? parseFloat(_getStyle(t, _transformOriginProp, cs, false, "0 0 0").split(" ")[2]) || tm.zOrigin || 0 : 0,
defaultTransformPerspective = parseFloat(CSSPlugin.defaultTransformPerspective) || 0,
isDefault, s, m, i, n, dec, scaleX, scaleY, rotation, skewX;
if (_transformProp) {
s = _getStyle(t, _transformPropCSS, cs, true);
@@ -3463,42 +3463,44 @@
while (--i > -1) {
n = Number(m[i]);
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).
}
if (m.length === 16) {
-
//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)
- var a13 = m[8], a23 = m[9], a33 = m[10],
- a14 = m[12], a24 = m[13], a34 = m[14];
+ var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3],
+ a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7],
+ a13 = m[8], a23 = m[9], a33 = m[10],
+ a14 = m[12], a24 = m[13], a34 = m[14],
+ a43 = m[11],
+ angle = Math.atan2(a32, a33),
+ t1, t2, t3, t4, cos, sin;
//we manually compensate for non-zero z component of transformOrigin to work around bugs in Safari
if (tm.zOrigin) {
a34 = -tm.zOrigin;
a14 = a13*a34-m[12];
a24 = a23*a34-m[13];
a34 = a33*a34+tm.zOrigin-m[14];
}
- var a11 = m[0], a21 = m[1], a31 = m[2], a41 = m[3],
- a12 = m[4], a22 = m[5], a32 = m[6], a42 = m[7],
- a43 = m[11],
- angle = Math.atan2(a21, a22),
- t1, t2, t3, cos, sin;
-
- //rotation
- tm.rotation = angle * _RAD2DEG;
+ tm.rotationX = angle * _RAD2DEG;
+ //rotationX
if (angle) {
cos = Math.cos(-angle);
sin = Math.sin(-angle);
- a11 = a11*cos+a12*sin;
- t2 = a21*cos+a22*sin;
- a22 = a21*-sin+a22*cos;
- a32 = a31*-sin+a32*cos;
- a21 = t2;
+ t1 = a12*cos+a13*sin;
+ t2 = a22*cos+a23*sin;
+ t3 = a32*cos+a33*sin;
+ a13 = a12*-sin+a13*cos;
+ a23 = a22*-sin+a23*cos;
+ a33 = a32*-sin+a33*cos;
+ a43 = a42*-sin+a43*cos;
+ a12 = t1;
+ a22 = t2;
+ a32 = t3;
}
-
//rotationY
- angle = Math.atan2(a13, a11);
+ angle = Math.atan2(a13, a33);
tm.rotationY = angle * _RAD2DEG;
if (angle) {
cos = Math.cos(-angle);
sin = Math.sin(-angle);
t1 = a11*cos-a13*sin;
@@ -3509,29 +3511,28 @@
a43 = a41*sin+a43*cos;
a11 = t1;
a21 = t2;
a31 = t3;
}
-
- //rotationX
- angle = Math.atan2(a32, a33);
- tm.rotationX = angle * _RAD2DEG;
+ //rotationZ
+ angle = Math.atan2(a21, a11);
+ tm.rotation = angle * _RAD2DEG;
if (angle) {
cos = Math.cos(-angle);
sin = Math.sin(-angle);
- t1 = a12*cos+a13*sin;
- t2 = a22*cos+a23*sin;
- t3 = a32*cos+a33*sin;
- a13 = a12*-sin+a13*cos;
- a23 = a22*-sin+a23*cos;
- a33 = a32*-sin+a33*cos;
- a43 = a42*-sin+a43*cos;
- a12 = t1;
- a22 = t2;
- a32 = t3;
+ a11 = a11*cos+a12*sin;
+ t2 = a21*cos+a22*sin;
+ a22 = a21*-sin+a22*cos;
+ a32 = a31*-sin+a32*cos;
+ a21 = t2;
}
+ if (tm.rotationX && Math.abs(tm.rotationX) + Math.abs(tm.rotation) > 359.9) { //when rotationY is set, it will often be parsed as 180 degrees different than it should be, and rotationX and rotation both being 180 (it looks the same), so we adjust for that here.
+ tm.rotationX = tm.rotation = 0;
+ tm.rotationY += 180;
+ }
+
tm.scaleX = ((Math.sqrt(a11 * a11 + a21 * a21) * rnd + 0.5) | 0) / rnd;
tm.scaleY = ((Math.sqrt(a22 * a22 + a23 * a23) * rnd + 0.5) | 0) / rnd;
tm.scaleZ = ((Math.sqrt(a32 * a32 + a33 * a33) * rnd + 0.5) | 0) / rnd;
tm.skewX = 0;
tm.perspective = a43 ? 1 / ((a43 < 0) ? -a43 : a43) : 0;
@@ -3577,11 +3578,11 @@
if (tm[i] < min) if (tm[i] > -min) {
tm[i] = 0;
}
}
}
- //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);
+ //DEBUG: _log("parsed rotation of " + t.getAttribute("id")+": "+(tm.rotationX)+", "+(tm.rotationY)+", "+(tm.rotation)+", scale: "+tm.scaleX+", "+tm.scaleY+", "+tm.scaleZ+", position: "+tm.x+", "+tm.y+", "+tm.z+", perspective: "+tm.perspective);
if (rec) {
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)
}
return tm;
},
@@ -3663,10 +3664,18 @@
style[prop] = (t[prop] = Math.round( val - dif * ((i === 0 || i === 2) ? 1 : mult) )) + "px";
}
}
},
+ /* translates a super small decimal to a string WITHOUT scientific notation
+ _safeDecimal = function(n) {
+ var s = (n < 0 ? -n : n) + "",
+ a = s.split("e-");
+ return (n < 0 ? "-0." : "0.") + new Array(parseInt(a[1], 10) || 0).join("0") + a[0].split(".").join("");
+ },
+ */
+
_set3DTransformRatio = _internals.set3DTransformRatio = function(v) {
var t = this.data, //refers to the element's _gsTransform object
style = this.t.style,
angle = t.rotation * _DEG2RAD,
sx = t.scaleX,
@@ -3674,33 +3683,31 @@
sz = t.scaleZ,
x = t.x,
y = t.y,
z = t.z,
perspective = t.perspective,
- a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43,
- zOrigin, rnd, cos, sin, t1, t2, t3, t4, transform, comma;
- 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
+ a11, a12, a13, a21, a22, a23, a31, a32, a33, a41, a42, a43,
+ zOrigin, min, cos, sin, t1, t2, transform, comma, zero;
+ if (v === 1 || v === 0 || !t.force3D) if (t.force3D !== true) if (!t.rotationY && !t.rotationX && sz === 1 && !perspective && !z) { //on the final render (which could be 0 for a from tween), if there are no 3D aspects, render in 2D to free up memory and improve performance especially on mobile devices
_set2DTransformRatio.call(this, v);
return;
}
if (_isFirefox) {
- var n = 0.0001;
- if (sx < n && sx > -n) { //Firefox has a bug (at least in v25) that causes it to render the transparent part of 32-bit PNG images as black when displayed inside an iframe and the 3D scale is very small and doesn't change sufficiently enough between renders (like if you use a Power4.easeInOut to scale from 0 to 1 where the beginning values only change a tiny amount to begin the tween before accelerating). In this case, we force the scale to be 0.00002 instead which is visually the same but works around the Firefox issue.
+ min = 0.0001;
+ if (sx < min && sx > -min) { //Firefox has a bug (at least in v25) that causes it to render the transparent part of 32-bit PNG images as black when displayed inside an iframe and the 3D scale is very small and doesn't change sufficiently enough between renders (like if you use a Power4.easeInOut to scale from 0 to 1 where the beginning values only change a tiny amount to begin the tween before accelerating). In this case, we force the scale to be 0.00002 instead which is visually the same but works around the Firefox issue.
sx = sz = 0.00002;
}
- if (sy < n && sy > -n) {
+ if (sy < min && sy > -min) {
sy = sz = 0.00002;
}
if (perspective && !t.z && !t.rotationX && !t.rotationY) { //Firefox has a bug that causes elements to have an odd super-thin, broken/dotted black border on elements that have a perspective set but aren't utilizing 3D space (no rotationX, rotationY, or z).
perspective = 0;
}
}
if (angle || t.skewX) {
- cos = Math.cos(angle);
- sin = Math.sin(angle);
- a11 = cos;
- a21 = sin;
+ cos = a11 = Math.cos(angle);
+ sin = a21 = Math.sin(angle);
if (t.skewX) {
angle -= t.skewX * _DEG2RAD;
cos = Math.cos(angle);
sin = Math.sin(angle);
if (t.skewType === "simple") { //by default, we compensate skewing on the other axis to make it look more natural, but you can set the skewType to "simple" to use the uncompensated skewing that CSS does
@@ -3718,45 +3725,64 @@
return;
} else {
a11 = a22 = 1;
a12 = a21 = 0;
}
+ // KEY INDEX AFFECTS
+ // a11 0 rotation, rotationY, scaleX
+ // a21 1 rotation, rotationY, scaleX
+ // a31 2 rotationY, scaleX
+ // a41 3 rotationY, scaleX
+ // a12 4 rotation, skewX, rotationX, scaleY
+ // a22 5 rotation, skewX, rotationX, scaleY
+ // a32 6 rotationX, scaleY
+ // a42 7 rotationX, scaleY
+ // a13 8 rotationY, rotationX, scaleZ
+ // a23 9 rotationY, rotationX, scaleZ
+ // a33 10 rotationY, rotationX, scaleZ
+ // a43 11 rotationY, rotationX, perspective, scaleZ
+ // a14 12 x, zOrigin, svgOrigin
+ // a24 13 y, zOrigin, svgOrigin
+ // a34 14 z, zOrigin
+ // a44 15
+ // rotation: Math.atan2(a21, a11)
+ // rotationY: Math.atan2(a13, a33) (or Math.atan2(a13, a11))
+ // rotationX: Math.atan2(a32, a33)
a33 = 1;
- a13 = a14 = a23 = a24 = a31 = a32 = a34 = a41 = a42 = 0;
+ a13 = a23 = a31 = a32 = a41 = a42 = 0;
a43 = (perspective) ? -1 / perspective : 0;
zOrigin = t.zOrigin;
- rnd = 100000;
+ min = 0.000001; //threshold below which browsers use scientific notation which won't work.
comma = ",";
+ zero = "0";
angle = t.rotationY * _DEG2RAD;
if (angle) {
cos = Math.cos(angle);
sin = Math.sin(angle);
- a31 = a33*-sin;
+ a31 = -sin;
a41 = a43*-sin;
a13 = a11*sin;
a23 = a21*sin;
- a33 *= cos;
+ a33 = cos;
a43 *= cos;
a11 *= cos;
a21 *= cos;
}
angle = t.rotationX * _DEG2RAD;
if (angle) {
cos = Math.cos(angle);
sin = Math.sin(angle);
t1 = a12*cos+a13*sin;
t2 = a22*cos+a23*sin;
- t3 = a32*cos+a33*sin;
- t4 = a42*cos+a43*sin;
+ a32 = a33*sin;
+ a42 = a43*sin;
a13 = a12*-sin+a13*cos;
a23 = a22*-sin+a23*cos;
- a33 = a32*-sin+a33*cos;
- a43 = a42*-sin+a43*cos;
+ a33 = a33*cos;
+ a43 = a43*cos;
a12 = t1;
a22 = t2;
- a32 = t3;
- a42 = t4;
}
if (sz !== 1) {
a13*=sz;
a23*=sz;
a33*=sz;
@@ -3772,35 +3798,45 @@
a11*=sx;
a21*=sx;
a31*=sx;
a41*=sx;
}
- if (zOrigin) {
- a34 -= zOrigin;
- a14 = a13*a34;
- a24 = a23*a34;
- a34 = a33*a34+zOrigin;
+
+ if (zOrigin || t.svg) {
+ if (zOrigin) {
+ x += a13*-zOrigin;
+ y += a23*-zOrigin;
+ z += a33*-zOrigin+zOrigin;
+ }
+ if (t.svg) { //due to bugs in some browsers, we need to manage the transform-origin of SVG manually
+ x += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12);
+ y += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22);
+ }
+ if (x < min && x > -min) {
+ x = zero;
+ }
+ if (y < min && y > -min) {
+ y = zero;
+ }
+ if (z < min && z > -min) {
+ z = 0; //don't use string because we calculate perspective later and need the number.
+ }
}
- if (t.svg) { //due to bugs in some browsers, we need to manage the transform-origin of SVG manually
- a14 += t.xOrigin - (t.xOrigin * a11 + t.yOrigin * a12);
- a24 += t.yOrigin - (t.xOrigin * a21 + t.yOrigin * a22);
- }
- //we round the x, y, and z slightly differently to allow even larger values.
- a14 = (t1 = (a14 += x) - (a14 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a14 : a14;
- a24 = (t1 = (a24 += y) - (a24 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a24 : a24;
- a34 = (t1 = (a34 += z) - (a34 |= 0)) ? ((t1 * rnd + (t1 < 0 ? -0.5 : 0.5)) | 0) / rnd + a34 : a34;
//optimized way of concatenating all the values into a string. If we do it all in one shot, it's slower because of the way browsers have to create temp strings and the way it affects memory. If we do it piece-by-piece with +=, it's a bit slower too. We found that doing it in these sized chunks works best overall:
transform = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix3d(" : "matrix3d(");
- transform += ((a11 * rnd) | 0) / rnd + comma + ((a21 * rnd) | 0) / rnd + comma + ((a31 * rnd) | 0) / rnd;
- transform += comma + ((a41 * rnd) | 0) / rnd + comma + ((a12 * rnd) | 0) / rnd + comma + ((a22 * rnd) | 0) / rnd;
- transform += comma + ((a32 * rnd) | 0) / rnd + comma + ((a42 * rnd) | 0) / rnd + comma + ((a13 * rnd) | 0) / rnd;
- transform += comma + ((a23 * rnd) | 0) / rnd + comma + ((a33 * rnd) | 0) / rnd + comma + ((a43 * rnd) | 0) / rnd;
- transform += comma + a14 + comma + a24 + comma + a34 + comma + (perspective ? (1 + (-a34 / perspective)) : 1) + ")";
- style[_transformProp] = transform;
+ transform += ((a11 < min && a11 > -min) ? zero : a11) + comma + ((a21 < min && a21 > -min) ? zero : a21) + comma + ((a31 < min && a31 > -min) ? zero : a31);
+ transform += comma + ((a41 < min && a41 > -min) ? zero : a41) + comma + ((a12 < min && a12 > -min) ? zero : a12) + comma + ((a22 < min && a22 > -min) ? zero : a22);
+ if (t.rotationX || t.rotationY) { //performance optimization (often there's no rotationX or rotationY, so we can skip these calculations)
+ transform += comma + ((a32 < min && a32 > -min) ? zero : a32) + comma + ((a42 < min && a42 > -min) ? zero : a42) + comma + ((a13 < min && a13 > -min) ? zero : a13);
+ transform += comma + ((a23 < min && a23 > -min) ? zero : a23) + comma + ((a33 < min && a33 > -min) ? zero : a33) + comma + ((a43 < min && a43 > -min) ? zero : a43) + comma;
+ } else {
+ transform += ",0,0,0,0,1,0,";
+ }
+ transform += x + comma + y + comma + z + comma + (perspective ? (1 + (-z / perspective)) : 1) + ")";
- //OLD (slower on most devices): 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(",") + ")";
+ style[_transformProp] = transform;
},
_set2DTransformRatio = _internals.set2DTransformRatio = function(v) {
var t = this.data, //refers to the element's _gsTransform object
targ = this.t,
@@ -3938,11 +3974,11 @@
}
}
orig = v.transformOrigin;
if (orig && m1.svg) {
- _parseSVGOrigin(t, orig, m2);
+ _parseSVGOrigin(t, _parsePosition(orig), m2);
pt = new CSSPropTween(m1, "xOrigin", m1.xOrigin, m2.xOrigin - m1.xOrigin, pt, -1, "transformOrigin");
pt.b = m1.xOrigin;
pt.e = pt.xs0 = m2.xOrigin;
pt = new CSSPropTween(m1, "yOrigin", m1.yOrigin, m2.yOrigin - m1.yOrigin, pt, -1, "transformOrigin");
pt.b = m1.yOrigin;
@@ -4428,11 +4464,11 @@
es = es.substr(2);
en *= parseFloat(es);
esfx = es.replace(_suffixExp, "");
} else {
en = parseFloat(es);
- esfx = isStr ? es.substr((en + "").length) || "" : "";
+ esfx = isStr ? es.replace(_suffixExp, "") : "";
}
if (esfx === "") {
esfx = (p in _suffixMap) ? _suffixMap[p] : bsfx; //populate the end suffix, prioritizing the map, then if none is found, use the beginning suffix.
}
@@ -6186,10 +6222,10 @@
p.ratio = 0;
p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
p._notifyPluginsOfEnabled = p._lazy = false;
- TweenLite.version = "1.15.0";
+ TweenLite.version = "1.15.1";
TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
TweenLite.defaultOverwrite = "auto";
TweenLite.ticker = _ticker;
TweenLite.autoSleep = true;
TweenLite.lagSmoothing = function(threshold, adjustedLag) {
\ No newline at end of file