vendor/assets/javascripts/greensock/TweenMax.js in greensock-rails-1.11.6.0 vs vendor/assets/javascripts/greensock/TweenMax.js in greensock-rails-1.11.7.0

- old
+ new

@@ -1,8 +1,8 @@ /*! - * VERSION: 1.11.6 - * DATE: 2014-03-26 + * VERSION: 1.11.7 + * DATE: 2014-04-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. @@ -32,11 +32,11 @@ _isSelector = TweenLite._internals.isSelector, _isArray = TweenLite._internals.isArray, p = TweenMax.prototype = TweenLite.to({}, 0.1, {}), _blankArray = []; - TweenMax.version = "1.11.6"; + TweenMax.version = "1.11.7"; p.constructor = TweenMax; p.kill()._gc = false; TweenMax.killTweensOf = TweenMax.killDelayedCallsTo = TweenLite.killTweensOf; TweenMax.getTweensOf = TweenLite.getTweensOf; TweenMax.ticker = TweenLite.ticker; @@ -592,10 +592,11 @@ }, _tinyNum = 0.0000000001, _isSelector = TweenLite._internals.isSelector, _isArray = TweenLite._internals.isArray, _blankArray = [], + _globals = window._gsDefine.globals, _copy = function(vars) { var copy = {}, p; for (p in vars) { copy[p] = vars[p]; } @@ -608,24 +609,26 @@ } }, _slice = _blankArray.slice, p = TimelineLite.prototype = new SimpleTimeline(); - TimelineLite.version = "1.11.6"; + TimelineLite.version = "1.11.7"; p.constructor = TimelineLite; p.kill()._gc = false; p.to = function(target, duration, vars, position) { - return duration ? this.add( new TweenLite(target, duration, vars), position) : this.set(target, vars, position); + var Engine = (vars.repeat && _globals.TweenMax) || TweenLite; + return duration ? this.add( new Engine(target, duration, vars), position) : this.set(target, vars, position); }; p.from = function(target, duration, vars, position) { - return this.add( TweenLite.from(target, duration, vars), position); + return this.add( ((vars.repeat && _globals.TweenMax) || TweenLite).from(target, duration, vars), position); }; p.fromTo = function(target, duration, fromVars, toVars, position) { - return duration ? this.add( TweenLite.fromTo(target, duration, fromVars, toVars), position) : this.set(target, toVars, position); + var Engine = (toVars.repeat && _globals.TweenMax) || TweenLite; + return duration ? this.add( Engine.fromTo(target, duration, fromVars, toVars), position) : this.set(target, toVars, position); }; p.staggerTo = function(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams, onCompleteAllScope) { var tl = new TimelineLite({onComplete:onCompleteAll, onCompleteParams:onCompleteAllParams, onCompleteScope:onCompleteAllScope, smoothChildTiming:this.smoothChildTiming}), i; @@ -1205,11 +1208,11 @@ _easeNone = new Ease(null, null, 1, 0), p = TimelineMax.prototype = new TimelineLite(); p.constructor = TimelineMax; p.kill()._gc = false; - TimelineMax.version = "1.11.6"; + TimelineMax.version = "1.11.7"; p.invalidate = function() { this._yoyo = (this.vars.yoyo === true); this._repeat = this.vars.repeat || 0; this._repeatDelay = this.vars.repeatDelay || 0; @@ -1926,11 +1929,11 @@ BezierPlugin = window._gsDefine.plugin({ propName: "bezier", priority: -1, - version: "1.3.1", + version: "1.3.2", API: 2, global:true, //gets called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run. init: function(target, vars, tween) { @@ -2061,11 +2064,11 @@ while (--i > -1) { p = this._props[i]; b = this._beziers[p][curIndex]; val = (t * t * b.da + 3 * inv * (t * b.ca + inv * b.ba)) * t + b.a; if (this._round[p]) { - val = (val + ((val > 0) ? 0.5 : -0.5)) >> 0; + val = Math.round(val); } if (func[p]) { target[p](val); } else { target[p] = val; @@ -2233,11 +2236,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.11.6"; + CSSPlugin.version = "1.11.7"; 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:""}; @@ -2341,12 +2344,11 @@ return _getIEOpacity(t); } if (!calc && t.style[p]) { rv = t.style[p]; } else if ((cs = cs || _getComputedStyle(t, null))) { - t = cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase()); - rv = (t || cs.length) ? t : cs[p]; //Opera behaves VERY strangely - length is usually 0 and cs[p] is the only way to get accurate results EXCEPT when checking for -o-transform which only works with cs.getPropertyValue()! + rv = cs[p] || cs.getPropertyValue(p) || cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase()); } else if (t.currentStyle) { rv = t.currentStyle[p]; } return (dflt != null && (!rv || rv === "none" || rv === "auto" || rv === "auto auto")) ? dflt : rv; }, @@ -2365,27 +2367,37 @@ if (sfx === "auto" || !v) { return 0; } var horiz = _horizExp.test(p), node = t, style = _tempDiv.style, neg = (v < 0), - pix; + pix, cache, time; if (neg) { v = -v; } if (sfx === "%" && p.indexOf("border") !== -1) { pix = (v / 100) * (horiz ? t.clientWidth : t.clientHeight); } else { style.cssText = "border:0 solid red;position:" + _getStyle(t, "position") + ";line-height:0;"; if (sfx === "%" || !node.appendChild) { node = t.parentNode || _doc.body; + cache = node._gsCache; + time = TweenLite.ticker.frame; + if (cache && horiz && cache.time === time) { //performance optimization: we record the width of elements along with the ticker frame so that we can quickly get it again on the same tick (seems relatively safe to assume it wouldn't change on the same tick) + return cache.width * v / 100; + } style[(horiz ? "width" : "height")] = v + sfx; } else { style[(horiz ? "borderLeftWidth" : "borderTopWidth")] = v + sfx; } node.appendChild(_tempDiv); pix = parseFloat(_tempDiv[(horiz ? "offsetWidth" : "offsetHeight")]); node.removeChild(_tempDiv); + if (horiz && sfx === "%" && CSSPlugin.cacheWidths !== false) { + cache = node._gsCache = node._gsCache || {}; + cache.time = time; + cache.width = pix / v * 100; + } if (pix === 0 && !recurse) { pix = _convertToPixels(t, p, v, sfx, true); } } return neg ? -pix : pix; @@ -2757,11 +2769,11 @@ min = 0.000001, val, pt, i, str; while (mpt) { val = proxy[mpt.v]; if (mpt.r) { - val = (val > 0) ? (val + 0.5) | 0 : (val - 0.5) | 0; + val = Math.round(val); } else if (val < min && val > -min) { val = 0; } mpt.t[mpt.p] = val; mpt = mpt._next; @@ -3643,19 +3655,19 @@ 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 + ")"; } }; _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) { + //TODO: when plugins use this, don't assume we're done with all the transforms. If bezier handles x/y and the user does a separate rotation tween outside of the bezier, this would break it and ignore the rotation part. if (cssp._transform) { return pt; } //only need to parse the transform once, and only if the browser supports it. var m1 = cssp._transform = _getTransform(t, _cs, true, vars.parseTransform), style = t.style, min = 0.000001, i = _transformProps.length, v = vars, endRotations = {}, m2, skewY, copy, orig, has3D, hasChange, dr; - if (typeof(v.transform) === "string" && _transformProp) { //for values like transform:"rotate(60deg) scale(0.5, 0.8)" copy = style.cssText; style[_transformProp] = v.transform; style.display = "block"; //if display is "none", the browser often refuses to report the transform properties correctly. m2 = _getTransform(t, null, false); @@ -3936,10 +3948,13 @@ var _removeProp = function(s, p) { if (p) { if (s.removeProperty) { + if (p.substr(0,2) === "ms") { //Microsoft browsers don't conform to the standard of capping the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example) + p = "M" + p.substr(1); + } s.removeProperty(p.replace(_capsExp, "-$1").toLowerCase()); } else { //note: old versions of IE use "removeAttribute()" instead of "removeProperty()" s.removeAttribute(p); } } @@ -4208,11 +4223,11 @@ } es = (en || en === 0) ? (rel ? en + bn : en) + esfx : vars[p]; //ensures that any += or -= prefixes are taken care of. Record the end value before normalizing the suffix because we always want to end the tween on exactly what they intended even if it doesn't match the beginning value's suffix. //if the beginning/ending suffixes don't match, normalize them... - if (bsfx !== esfx) if (esfx !== "") if (en || en === 0) if (bn || bn === 0) { + if (bsfx !== esfx) if (esfx !== "") if (en || en === 0) if (bn) { //note: if the beginning value (bn) is 0, we don't need to convert units! bn = _convertToPixels(target, p, bn, bsfx); if (esfx === "%") { bn /= _convertToPixels(target, p, 100, "%") / 100; if (vars.strictUnits !== true) { //some browsers report only "px" values instead of allowing "%" with getComputedStyle(), so we assume that if we're tweening to a %, we should start there too unless strictUnits:true is defined. This approach is particularly useful for responsive designs that use from() tweens. bs = bn + "%"; @@ -4220,11 +4235,11 @@ } else if (esfx === "em") { bn /= _convertToPixels(target, p, 1, "em"); //otherwise convert to pixels. - } else { + } else if (esfx !== "px") { en = _convertToPixels(target, p, en, esfx); esfx = "px"; //we don't use bsfx after this, so we don't need to set it to px too. } if (rel) if (en || en === 0) { es = (en + bn) + esfx; //the changes we made affect relative calculations, so adjust the end value here. @@ -4275,11 +4290,11 @@ } else if (v || !(this._tween._time === this._tween._duration || this._tween._time === 0) || this._tween._rawPrevTime === -0.000001) { while (pt) { val = pt.c * v + pt.s; if (pt.r) { - val = (val > 0) ? (val + 0.5) | 0 : (val - 0.5) | 0; + val = Math.round(val); } else if (val < min) if (val > -min) { val = 0; } if (!pt.type) { pt.t[pt.p] = val + pt.xs0; @@ -5900,11 +5915,11 @@ p.ratio = 0; p._firstPT = p._targets = p._overwrittenProps = p._startAt = null; p._notifyPluginsOfEnabled = false; - TweenLite.version = "1.11.6"; + TweenLite.version = "1.11.7"; TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1); TweenLite.defaultOverwrite = "auto"; TweenLite.ticker = _ticker; TweenLite.autoSleep = true; 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; }; @@ -6542,10 +6557,10 @@ min = 0.000001, val; while (pt) { val = pt.c * v + pt.s; if (pt.r) { - val = (val + ((val > 0) ? 0.5 : -0.5)) | 0; //about 4x faster than Math.round() + val = Math.round(val); } else if (val < min) if (val > -min) { //prevents issues with converting very small numbers to strings in the browser val = 0; } if (pt.f) { pt.t[pt.p](val); \ No newline at end of file