vendor/assets/javascripts/greensock/TweenMax.js in greensock-rails-1.14.1.0 vs vendor/assets/javascripts/greensock/TweenMax.js in greensock-rails-1.14.2.0
- old
+ new
@@ -1,8 +1,8 @@
/*!
- * VERSION: 1.14.1
- * DATE: 2014-10-16
+ * VERSION: 1.14.2
+ * DATE: 2014-10-29
* UPDATES AND DOCS AT: http://www.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.
@@ -39,11 +39,11 @@
_isSelector = TweenLiteInternals.isSelector,
_isArray = TweenLiteInternals.isArray,
p = TweenMax.prototype = TweenLite.to({}, 0.1, {}),
_blankArray = [];
- TweenMax.version = "1.14.1";
+ TweenMax.version = "1.14.2";
p.constructor = TweenMax;
p.kill()._gc = false;
TweenMax.killTweensOf = TweenMax.killDelayedCallsTo = TweenLite.killTweensOf;
TweenMax.getTweensOf = TweenLite.getTweensOf;
TweenMax.lagSmoothing = TweenLite.lagSmoothing;
@@ -57,11 +57,13 @@
this._uncache(true);
return TweenLite.prototype.invalidate.call(this);
};
p.updateTo = function(vars, resetDuration) {
- var curRatio = this.ratio, p;
+ var curRatio = this.ratio,
+ immediate = this.vars.immediateRender || vars.immediateRender,
+ p;
if (resetDuration && this._startTime < this._timeline._time) {
this._startTime = this._timeline._time;
this._uncache(false);
if (this._gc) {
this._enabled(true, false);
@@ -70,11 +72,11 @@
}
}
for (p in vars) {
this.vars[p] = vars[p];
}
- if (this._initted) {
+ if (this._initted || immediate) {
if (resetDuration) {
this._initted = false;
} else {
if (this._gc) {
this._enabled(true, false);
@@ -85,11 +87,11 @@
if (this._time / this._duration > 0.998) { //if the tween has finished (or come extremely close to finishing), we just need to rewind it to 0 and then render it again at the end which forces it to re-initialize (parsing the new vars). We allow tweens that are close to finishing (but haven't quite finished) to work this way too because otherwise, the values are so small when determining where to project the starting values that binary math issues creep in and can make the tween appear to render incorrectly when run backwards.
var prevTime = this._time;
this.render(0, true, false);
this._initted = false;
this.render(prevTime, true, false);
- } else if (this._time > 0) {
+ } else if (this._time > 0 || immediate) {
this._initted = false;
this._init();
var inv = 1 / (1 - curRatio),
pt = this._firstPT, endValue;
while (pt) {
@@ -655,11 +657,11 @@
for (i = 0; i !== l; b.push(a[i++]));
return b;
},
p = TimelineLite.prototype = new SimpleTimeline();
- TimelineLite.version = "1.14.1";
+ TimelineLite.version = "1.14.2";
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.
@@ -1306,11 +1308,11 @@
_easeNone = new Ease(null, null, 1, 0),
p = TimelineMax.prototype = new TimelineLite();
p.constructor = TimelineMax;
p.kill()._gc = false;
- TimelineMax.version = "1.14.1";
+ TimelineMax.version = "1.14.2";
p.invalidate = function() {
this._yoyo = (this.vars.yoyo === true);
this._repeat = this.vars.repeat || 0;
this._repeatDelay = this.vars.repeatDelay || 0;
@@ -2339,22 +2341,22 @@
_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.14.1";
+ CSSPlugin.version = "1.14.2";
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:""};
var _numExp = /(?:\d|\-\d|\.\d|\-\.\d)+/g,
_relNumExp = /(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,
_valuesExp = /(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi, //finds all the values that begin with numbers or += or -= and then a number. Includes suffixes. We use this to split complex values apart like "1px 5px 20px rgb(255,102,51)"
- _NaNExp = /[^\d\-\.]/g,
+ _NaNExp = /(?![+-]?\d*\.?\d+|e[+-]\d+)[^0-9]/g, //also allows scientific notation
_suffixExp = /(?:\d|\-|\+|=|#|\.)*/g,
_opacityExp = /opacity *= *([^)]*)/i,
_opacityValExp = /opacity:([^;]*)/i,
_alphaFilterExp = /alpha\(opacity *=.+?\)/i,
_rgbhslExp = /^(rgb|hsl)/,
@@ -2368,11 +2370,10 @@
_commasOutsideParenExp = /,(?=[^\)]*(?:\(|$))/gi, //finds any commas that are not within parenthesis
_DEG2RAD = Math.PI / 180,
_RAD2DEG = 180 / Math.PI,
_forcePT = {},
_doc = document,
- _docElement = _doc.documentElement,
_tempDiv = _doc.createElement("div"),
_tempImg = _doc.createElement("img"),
_internals = CSSPlugin._internals = {_specialProps:_specialProps}, //provides a hook to a few internal methods that we need to access from inside other plugins
_agent = navigator.userAgent,
_autoRound,
@@ -2718,11 +2719,11 @@
/**
* @private Parses a color (like #9F0, #FF9900, or rgb(255,51,153)) into an array with 3 elements for red, green, and blue. Also handles rgba() values (splits into array of 4 elements of course)
* @param {(string|number)} v The value the should be parsed which could be a string like #9F0 or rgb(255,102,51) or rgba(255,0,0,0.5) or it could be a number like 0xFF00CC or even a named color like red, blue, purple, etc.
* @return {Array.<number>} An array containing red, green, and blue (and optionally alpha) in that order.
*/
- _parseColor = function(v) {
+ _parseColor = CSSPlugin.parseColor = function(v) {
var c1, c2, c3, h, s, l;
if (!v || v === "") {
return _colorLookup.black;
}
if (typeof(v) === "number") {
@@ -3355,49 +3356,49 @@
-
//transform-related methods and properties
var _transformProps = ("scaleX,scaleY,scaleZ,x,y,z,skewX,skewY,rotation,rotationX,rotationY,perspective,xPercent,yPercent").split(","),
_transformProp = _checkPropPrefix("transform"), //the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform.
_transformPropCSS = _prefixCSS + "transform",
_transformOriginProp = _checkPropPrefix("transformOrigin"),
_supports3D = (_checkPropPrefix("perspective") !== null),
Transform = _internals.Transform = function() {
this.skewY = 0;
},
_SVGElement = window.SVGElement,
- _forceSVGTransformToAttr = (_SVGElement && (_ieVers || (/Android/i.test(_agent) && !window.chrome))), //IE and Android stock don't support CSS transforms on SVG elements, so we must write them to the "transform" attribute.
+ _useSVGTransformAttr,
//Some browsers (like Firefox and IE) don't honor transform-origin properly in SVG elements, so we need to manually adjust the matrix accordingly. We feature detect here rather than always doing the conversion for certain browsers because they may fix the problem at some point in the future.
- /* originally used to sense browsers that didn't handle SVG transform-origin properly, but due to all the fragmentation and odd behavior across browsers, we decided to just manage transform-origin internally for all browsers.
_createSVG = function(type, container, attributes) {
var element = _doc.createElementNS("http://www.w3.org/2000/svg", type),
reg = /([a-z])([A-Z])/g,
p;
for (p in attributes) {
element.setAttributeNS(null, p.replace(reg, "$1-$2").toLowerCase(), attributes[p]);
}
container.appendChild(element);
return element;
},
- _fixSVGOrigin = (function() {
- if (_doc.createElementNS) { //IE8 and earlier doesn't support SVG anyway
- var svg = _createSVG("svg", _docElement),
- rect = _createSVG("rect", svg, {width:100, height:50, x:100}),
- left, matches;
+ _docElement = document.documentElement,
+ _forceSVGTransformAttr = (function() {
+ //IE and Android stock don't support CSS transforms on SVG elements, so we must write them to the "transform" attribute. We populate this variable in the _parseTransform() method, and only if/when we come across an SVG element
+ var force = _ieVers || (/Android/i.test(_agent) && !window.chrome),
+ svg, rect, left;
+ if (_doc.createElementNS && !force) { //IE8 and earlier doesn't support SVG anyway
+ svg = _createSVG("svg", _docElement);
+ rect = _createSVG("rect", svg, {width:100, height:50, x:100});
left = rect.getBoundingClientRect().left;
rect.style[_transformOriginProp] = "50% 50%";
rect.style[_transformProp] = "scale(0.5,0.5)";
- matches = (left === rect.getBoundingClientRect().left);
+ force = (left === rect.getBoundingClientRect().left);
_docElement.removeChild(svg);
- return matches;
}
+ return force;
})(),
- */
_parseSVGOrigin = function(e, origin, decoratee) {
var bbox = e.getBBox();
origin = _parsePosition(origin).split(" ");
decoratee.xOrigin = (origin[0].indexOf("%") !== -1 ? parseFloat(origin[0]) / 100 * bbox.width : parseFloat(origin[0])) + bbox.x;
decoratee.yOrigin = (origin[1].indexOf("%") !== -1 ? parseFloat(origin[1]) / 100 * bbox.height : parseFloat(origin[1])) + bbox.y;
@@ -3578,13 +3579,14 @@
}
//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);
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)
}
- tm.svg = (_SVGElement && (t instanceof _SVGElement));
+ tm.svg = (_SVGElement && (t instanceof _SVGElement) && (t.parentNode instanceof _SVGElement));
if (tm.svg) {
_parseSVGOrigin(t, _getStyle(t, _transformOriginProp, _cs, false, "50% 50%") + "", tm);
+ _useSVGTransformAttr = CSSPlugin.useSVGTransformAttr || _forceSVGTransformAttr;
}
tm.xPercent = tm.yPercent = 0;
return tm;
},
@@ -3797,11 +3799,11 @@
targ = this.t,
style = targ.style,
x = t.x,
y = t.y,
ang, skew, rnd, sx, sy, a, b, c, d, matrix, min;
- if ((t.rotationX || t.rotationY || t.z || t.force3D === true || (t.force3D === "auto" && v !== 1 && v !== 0)) && !(t.svg && _forceSVGTransformToAttr) && _supports3D) { //if a 3D tween begins while a 2D one is running, we need to kick the rendering over to the 3D method. For example, imagine a yoyo-ing, infinitely repeating scale tween running, and then the object gets rotated in 3D space with a different tween.
+ if ((t.rotationX || t.rotationY || t.z || t.force3D === true || (t.force3D === "auto" && v !== 1 && v !== 0)) && !(t.svg && _useSVGTransformAttr) && _supports3D) { //if a 3D tween begins while a 2D one is running, we need to kick the rendering over to the 3D method. For example, imagine a yoyo-ing, infinitely repeating scale tween running, and then the object gets rotated in 3D space with a different tween.
this.setRatio = _set3DTransformRatio;
_set3DTransformRatio.call(this, v);
return;
}
sx = t.scaleX;
@@ -3824,11 +3826,11 @@
if (y < min) if (y > -min) {
y = 0;
}
}
matrix = (((a * rnd) | 0) / rnd) + "," + (((b * rnd) | 0) / rnd) + "," + (((c * rnd) | 0) / rnd) + "," + (((d * rnd) | 0) / rnd) + "," + x + "," + y + ")";
- if (t.svg && _forceSVGTransformToAttr) {
+ if (t.svg && _useSVGTransformAttr) {
targ.setAttribute("transform", "matrix(" + matrix);
} else {
//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.
style[_transformProp] = ((t.xPercent || t.yPercent) ? "translate(" + t.xPercent + "%," + t.yPercent + "%) matrix(" : "matrix(") + matrix;
}
@@ -3931,12 +3933,13 @@
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;
pt.e = pt.xs0 = m2.yOrigin;
- _removeProp(style, _transformOriginProp); //certain browsers (like firefox) completely botch transform-origin, so we must remove it to prevent it from contaminating transforms. We manage it ourselves with xOrigin and yOrigin
- } else if (orig || (_supports3D && has3D && m1.zOrigin)) { //if anything 3D is happening and there's a transformOrigin with a z component that's non-zero, we must ensure that the transformOrigin's z-component is set to 0 so that we can manually do those calculations to get around Safari bugs. Even if the user didn't specifically define a "transformOrigin" in this particular tween (maybe they did it via css directly).
+ orig = "0px 0px"; //certain browsers (like firefox) completely botch transform-origin, so we must remove it to prevent it from contaminating transforms. We manage it ourselves with xOrigin and yOrigin
+ }
+ if (orig || (_supports3D && has3D && m1.zOrigin)) { //if anything 3D is happening and there's a transformOrigin with a z component that's non-zero, we must ensure that the transformOrigin's z-component is set to 0 so that we can manually do those calculations to get around Safari bugs. Even if the user didn't specifically define a "transformOrigin" in this particular tween (maybe they did it via css directly).
if (_transformProp) {
hasChange = true;
p = _transformOriginProp;
orig = (orig || _getStyle(t, p, _cs, false, "50% 50%")) + ""; //cast as string to avoid errors
pt = new CSSPropTween(style, p, 0, 0, pt, -1, "transformOrigin");
@@ -3958,11 +3961,11 @@
} else {
_parsePosition(orig + "", m1);
}
}
if (hasChange) {
- cssp._transformType = (!(m1.svg && _forceSVGTransformToAttr) && (has3D || this._transformType === 3)) ? 3 : 2; //quicker than calling cssp._enableTransforms();
+ cssp._transformType = (!(m1.svg && _useSVGTransformAttr) && (has3D || this._transformType === 3)) ? 3 : 2; //quicker than calling cssp._enableTransforms();
}
return pt;
}, prefix:true});
_registerComplexSpecialProp("boxShadow", {defaultValue:"0px 0px 0px 0px #999", prefix:true, color:true, multi:true, keyword:"inset"});
@@ -4033,11 +4036,11 @@
if ((bs.indexOf("%") !== -1) !== (es.indexOf("%") !== -1)) {
src = _getStyle(t, "backgroundImage").replace(_urlExp, "");
if (src && src !== "none") {
ba = bs.split(" ");
ea = es.split(" ");
- _tempImg.setAttribute("src", src); //set the temp <img>'s src to the background-image so that we can measure its width/height
+ _tempImg.setAttribute("src", src); //set the temp IMG's src to the background-image so that we can measure its width/height
i = 2;
while (--i > -1) {
bs = ba[i];
pct = (bs.indexOf("%") !== -1);
if (pct !== (ea[i].indexOf("%") !== -1)) {
@@ -4548,11 +4551,11 @@
*
* @param {boolean} threeD if true, it should apply 3D tweens (otherwise, just 2D ones are fine and typically faster)
*/
p._enableTransforms = function(threeD) {
this._transform = this._transform || _getTransform(this._target, _cs, true); //ensures that the element has a _gsTransform property with the appropriate values.
- this._transformType = (!(this._transform.svg && _forceSVGTransformToAttr) && (threeD || this._transformType === 3)) ? 3 : 2;
+ this._transformType = (!(this._transform.svg && _useSVGTransformAttr) && (threeD || this._transformType === 3)) ? 3 : 2;
};
var lazySet = function(v) {
this.t[this.p] = this.e;
this.data._linkCSSP(this, this._next, null, true); //we purposefully keep this._next even though it'd make sense to null it, but this is a performance optimization, as this happens during the while (pt) {} loop in setRatio() at the bottom of which it sets pt = pt._next, so if we null it, the linked list will be broken in that loop.
@@ -6170,11 +6173,11 @@
p.ratio = 0;
p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
p._notifyPluginsOfEnabled = p._lazy = false;
- TweenLite.version = "1.14.1";
+ TweenLite.version = "1.14.2";
TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
TweenLite.defaultOverwrite = "auto";
TweenLite.ticker = _ticker;
TweenLite.autoSleep = true;
TweenLite.lagSmoothing = function(threshold, adjustedLag) {
@@ -6275,30 +6278,30 @@
}
return _tweenLookup[id].tweens;
},
_onOverwrite = function(overwrittenTween, overwritingTween, target, killedProps) {
- var func = overwrittenTween.vars.onOverwrite;
+ var func = overwrittenTween.vars.onOverwrite, r1, r2;
if (func) {
- func(overwrittenTween, overwritingTween, target, killedProps);
+ r1 = func(overwrittenTween, overwritingTween, target, killedProps);
}
func = TweenLite.onOverwrite;
if (func) {
- func(overwrittenTween, overwritingTween, target, killedProps);
+ r2 = func(overwrittenTween, overwritingTween, target, killedProps);
}
+ return (r1 !== false && r2 !== false);
},
_applyOverwrite = function(target, tween, props, mode, siblings) {
var i, changed, curTween, l;
if (mode === 1 || mode >= 4) {
l = siblings.length;
for (i = 0; i < l; i++) {
if ((curTween = siblings[i]) !== tween) {
if (!curTween._gc) {
- if (curTween._enabled(false, false)) {
+ if (_onOverwrite(curTween, tween) && curTween._enabled(false, false)) {
changed = true;
}
- _onOverwrite(curTween, tween);
}
} else if (mode === 5) {
break;
}
}
@@ -6329,16 +6332,16 @@
curTween = overlaps[i];
if (mode === 2) if (curTween._kill(props, target, tween)) {
changed = true;
}
if (mode !== 2 || (!curTween._firstPT && curTween._initted)) {
+ if (mode !== 2 && !_onOverwrite(curTween, tween)) {
+ continue;
+ }
if (curTween._enabled(false, false)) { //if all property tweens have been overwritten, kill the tween.
changed = true;
}
- if (mode !== 2) {
- _onOverwrite(curTween, tween);
- }
}
}
return changed;
},
@@ -6715,16 +6718,26 @@
}
if (propLookup) {
killProps = vars || propLookup;
record = (vars !== overwrittenProps && overwrittenProps !== "all" && vars !== propLookup && (typeof(vars) !== "object" || !vars._tempKill)); //_tempKill is a super-secret way to delete a particular tweening property but NOT have it remembered as an official overwritten property (like in BezierPlugin)
+ if (overwritingTween && (TweenLite.onOverwrite || this.vars.onOverwrite)) {
+ for (p in killProps) {
+ if (propLookup[p]) {
+ if (!killed) {
+ killed = [];
+ }
+ killed.push(p);
+ }
+ }
+ if (!_onOverwrite(this, overwritingTween, target, killed)) { //if the onOverwrite returned false, that means the user wants to override the overwriting (cancel it).
+ return false;
+ }
+ }
+
for (p in killProps) {
if ((pt = propLookup[p])) {
- if (!killed) {
- killed = [];
- }
- killed.push(p);
if (pt.pg && pt.t._kill(killProps)) {
changed = true; //some plugins need to be notified so they can perform cleanup tasks first
}
if (!pt.pg || pt.t._overwriteProps.length === 0) {
if (pt._prev) {
@@ -6744,13 +6757,10 @@
}
}
if (!this._firstPT && this._initted) { //if all tweening properties are killed, kill the tween. Without this line, if there's a tween with multiple targets and then you killTweensOf() each target individually, the tween would technically still remain active and fire its onComplete even though there aren't any more properties tweening.
this._enabled(false, false);
}
- if (killed && overwritingTween) {
- _onOverwrite(this, overwritingTween, target, killed);
- }
}
}
return changed;
};
@@ -6866,10 +6876,10 @@
/*
* ----------------------------------------------------------------
- * TweenPlugin (could easily be split out as a separate file/class, but included for ease of use (so that people don't need to include another <script> call before loading plugins which is easy to forget)
+ * TweenPlugin (could easily be split out as a separate file/class, but included for ease of use (so that people don't need to include another script call before loading plugins which is easy to forget)
* ----------------------------------------------------------------
*/
var TweenPlugin = _class("plugins.TweenPlugin", function(props, priority) {
this._overwriteProps = (props || "").split(",");
this._propName = this._overwriteProps[0];
\ No newline at end of file