PageSourceSearch

https://www.dcbuilding.com/wp-content/themes/eris-child/assets/js/greensock/CSSRulePlugin.js?ver=0.1

js dcbuilding.com collected 2026-10-10 02:13:07 UTC 31,960 bytes, 631 lines download raw bytes

1/*!
2 * VERSION: beta 0.11
3 * DATE: 2012-05-31
4 * JavaScript 
5 * UPDATES AND DOCS AT: http://www.greensock.com
6 *
7 * Copyright (c) 2008-2012, GreenSock. All rights reserved. 
8 * This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for 
9 * corporate Club GreenSock members, the software agreement that was issued with the corporate 
10 * membership.
11 * 
12 * @author: Jack Doyle, [email protected]
13 */
14(window._gsQueue || (window._gsQueue = [])).push( function() {
15	
16	_gsDefine("plugins.CSSRulePlugin", ["plugins.TweenPlugin","TweenLite"], function(TweenPlugin, TweenLite) {
17		
18		"use strict";
19		
20		var CSSRulePlugin = function() {
21				TweenPlugin.call(this, "cssRule");
22				this._overwriteProps.pop();
23			},
24			p = CSSRulePlugin.prototype = new TweenPlugin("cssRule");
25		
26		p.constructor = CSSRulePlugin;
27		CSSRulePlugin.API = 2;
28		CSSRulePlugin.suffixMap = {top:"px", right:"px", bottom:"px", left:"px", width:"px", height:"px", fontSize:"px", padding:"px", margin:"px"};
29			
30		//set up some local variables and functions that we can reuse for all tweens - we do this only once and cache things to improve performance
31		var _NaNExp = /[^\d\-\.]/g,
32			_suffixExp = /(\d|\-|\+|=|#|\.)*/g,
33			_numExp = /\d+/g,
34			_opacityExp = /opacity=([^)]*)/,
35			_opacityValExp = /opacity:([^;]*)/,
36			_capsExp = /([A-Z])/g,
37			_camelExp = /-([a-z])/gi,
38			_camelFunc = function(s, g) { return g.toUpperCase() },
39			_horizExp = /(Left|Right|Width)/i,
40			_ieGetMatrixExp = /(M11|M12|M21|M22)=[\d\-\.e]+/gi,
41			_ieSetMatrixExp = /progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,
42			_DEG2RAD = Math.PI / 180,
43			_RAD2DEG = 180 / Math.PI,
44			_tempDiv = document.createElement("div"),
45			
46			//primarily for older versions of IE
47			_supportsOpacity = (function() {
48				var d = document.createElement("div"), a;
49				d.innerHTML = "<a style='top:1px;opacity:.55;'>a</a>";
50				if (!(a = d.getElementsByTagName("a")[0])) {
51					return false;
52				}
53				return /^0.55/.test(a.style.opacity);
54			})(),
55			
56			//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) 
57			_parseColor = function(color) {
58				if (color == null || color === "") {
59					return _colorLookup.transparent;
60				} else if (_colorLookup[color]) {
61					return _colorLookup[color];
62				} else if (color.charAt(0) === "#") {
63					if (color.length === 4) { //for shorthand like #9F0
64						color = "#" + color.charAt(1) + color.charAt(1) + color.charAt(2) + color.charAt(2) + color.charAt(3) + color.charAt(3);
65					}
66					color = parseInt(color.substr(1), 16);
67					return [color >> 16, (color >> 8) & 255, color & 255];
68				} else {
69					return color.match(_numExp) || _colorLookup.transparent;
70				}
71			},
72			_getIEOpacity = function(obj) {
73				return (_opacityExp.test( ((typeof(obj) === "string") ? obj : (obj.currentStyle ? obj.currentStyle.filter : obj.style.filter) || "") ) ? ( parseFloat( RegExp.$1 ) / 100 ) : 1);
74			},
75			_getComputedStyle = (document.defaultView) ? document.defaultView.getComputedStyle : function(o,s) {},
76			
77			//gets an individual style property. cs is for computedStyle (a speed optimization - we don't want to run it more than once if we don't have to). calc forces the returned value to be based on the computedStyle, ignoring anything that's in the element's "style" property (computing normalizes certain things for us)
78			_getStyle = function(t, p, cs, calc) { 
79				if (!_supportsOpacity && p === "opacity") { //several versions of IE don't use the standard "opacity" property - they use things like filter:alpha(opacity=50), so we parse that here.
80					return _getIEOpacity(t);
81				} else if (!calc && t.style[p]) {
82					return t.style[p];
83				} else if ((cs = cs || _getComputedStyle(t, null))) {
84					t = cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase());
85					return (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 w
85orks with cs.getPropertyValue()!
86				} else if (t.currentStyle) {
87					return t.currentStyle[p];
88				}
89				return null;
90			},
91			
92			_transformMap = {scaleX:1, scaleY:1, x:1, y:1, rotation:1, shortRotation:1, skewX:1, skewY:1, scale:1},
93			
94			//the css transform property, like -ms-transform, -webkit-transform, -moz-transform, or -o-transform (we populate this in the method that's called for _transformProp
95			_transformPropCSS,
96			
97			//the Javascript (camelCase) transform property, like msTransform, WebkitTransform, MozTransform, or OTransform.
98			_transformProp = (function() { //determines the transform property to use (with the appropriate vendor prefix).
99				var d = document.body || document.documentElement,
100					cs = _getComputedStyle(d, ""),
101					a = ["O","-o-","Moz","-moz-","ms","-ms-","Webkit","-webkit-"],
102					i = 9;
103				while ((i-=2) > -1 && !_getStyle(d, a[i]+"transform", cs)) { }
104				if (i > 0) {
105					_transformPropCSS = a[i] + "transform";
106					return a[i-1] + "Transform";
107				}
108				return null;
109			})(),
110			
111			_getRule = CSSRulePlugin.getRule = function(selector) {
112				var ruleProp = document.all ? 'rules' : 'cssRules',
113					ss = document.styleSheets,
114					i = ss.length, 
115					pseudo = (selector.charAt(0) === ":"),
116					j, curSS, a;
117				selector = (pseudo ? "" : ",") + selector + ",";
118				if (pseudo) {
119					a = [];
120				}
121				while (--i > -1) {
122					curSS = ss[i][ruleProp];
123					j = curSS.length;
124					while (--j > -1) {
125						if ((","+curSS[j].selectorText.split("::").join(":")+",").indexOf(selector) !== -1) { //note: IE adds an extra ":" to pseudo selectors, so .myClass:after becomes .myClass::after, so we need to strip the extra one out.
126							if (pseudo) {
127								a.push(curSS[j].style);
128							} else {
129								return curSS[j].style;
130							}
131						}
132					}
133				}
134				return a;
135			},
136						
137			//parses the transform values for an element, returning an object with x, y, scaleX, scaleY, rotation, skewX, and skewY properties. Note: by default (for performance reasons), all skewing is combined into skewX and rotation but skewY still has a place in the transform object so that we can record how much of the skew is attributed to skewX vs skewY. Remember, a skewY of 10 looks the same as a rotation of 10 and skewX of -10.
138			_getTransform = function(style, rec) {
139				_tempDiv.cssText = style.cssText;
140				var t = _tempDiv, s;
141				if (_transformProp) {
142					s = _getStyle(t, _transformPropCSS, null, true);
143				} else if (t.currentStyle) {
144					//for older versions of IE, we need to interpret the filter portion that is in the format: progid:DXImageTransform.Microsoft.Matrix(M11=6.123233995736766e-17, M12=-1, M21=1, M22=6.123233995736766e-17, sizingMethod='auto expand') Notice that we need to swap b and c compared to a normal matrix.
145					s = t.currentStyle.filter.match(_ieGetMatrixExp);
146					s = (s && s.length === 4) ? s[0].substr(4) + "," + Number(s[2].substr(4)) + "," + Number(s[1].substr(4)) + "," + s[3].substr(4) + ",0,0" : null;
147				}
148				var v = (s || "").replace(/[^\d\-\.e,]/g, "").split(","), 
149					k = (v.length >= 6),
150					a = k ? Number(v[0]) : 1,
151					b = k ? Number(v[1]) : 0,
152					c = k ? Number(v[2]) : 0,
153					d = k ? Number(v[3]) : 1,
154					min = 0.000001,
155					m = rec ? style._gsTransform || {skewY:0} : {skewY:0},
156					invX = (m.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.
157				
158				m.x = (k ? Number(v[4]) : 0);
159				m.y = (k ? Number(v[5]) : 0);
160				m.scaleX = Math.sqrt(a * a + b * b);
161				m.scaleY = Math.sqrt(d * d + c * c);
162				m.rotation = (a || b) ? Math.atan2(b, a) : m.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).
163				m.skewX = (c || d) ? Math.atan2(c, d) + m.rotation : m.skewX || 0;
164				if ((a < 0 && d >= 0) || (a > 0 && d <= 0)) {
165					if (invX) {
166						m.scaleX *= -1;
167						m.skewX += (m.rotation <= 0) ? Math.PI : -Math.PI;
168						m.rotation += (m.rotation <= 0) ? Math.PI : -Math.PI;
169					} else {
170						m.scaleY *= -1;
171						m.skewX += (m.skewX <= 0) ? Math.PI : -Math.PI;
172					}
173				}
174				//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().
175				if (m.rotation < min) if (m.rotation > -min) if (a || b) {
176					m.rotation = 0;
177				}
178				if (m.skewX < min) if (m.skewX > -min) if (b || c) {
179					m.skewX = 0;
180				}
181				if (rec) {
182					style._gsTransform = m; //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)
183				}
184				return m;
185			},
186			
187			_dimensions = {width:["Left","Right"], height:["Top","Bottom"]},
188			_margins = ["marginLeft","marginRight","marginTop","marginBottom"], 
189			
190			//for parsing things like transformOrigin or backgroundPosition which must recognize keywords like top/left/right/bottom/center as well as percentages and pixel values. Decorates the supplied object with the following properties: "ox" (offsetX), "oy" (offsetY), "oxp" (if true, "ox" is a percentage not a pixel value), and "oxy" (if true, "oy" is a percentage not a pixel value)
191			_parsePosition = function(v, o) {
192				if (v == null || v === "" || v === "auto") {
193					v = "0 0";
194				}
195				o = o || {};
196				var x = (v.indexOf("left") !== -1) ? "0%" : (v.indexOf("right") !== -1) ? "100%" : v.split(" ")[0],
197					y = (v.indexOf("top") !== -1) ? "0%" : (v.indexOf("bottom") !== -1) ? "100%" : v.split(" ")[1];
198				if (y == null) {
199					y = "0";
200				} else if (y === "center") {
201					y = "50%";
202				}
203				if (x === "center") {
204					x = "50%";
205				}
206				o.oxp = (x.indexOf("%") !== -1);
207				o.oyp = (y.indexOf("%") !== -1);
208				o.oxr = (x.charAt(1) === "=");
209				o.oyr = (y.charAt(1) === "=");
210				o.ox = parseFloat(x.replace(_NaNExp, ""));
211				o.oy = parseFloat(y.replace(_NaNExp, ""));
212				return o;
213			},
214			
215			//takes a value and a default number, checks if the value is relative, null, or numeric and spits back a normalized number accordingly. Primarily used in the _parseTransform() function.
216			_parseVal = function(v, d) {
217				return (v == null) ? d : (typeof(v) === "string" && v.indexOf("=") === 1) ? Number(v.split("=").join("")) + d : Number(v);
218			},
219			
220			//translates strings like "40deg" or "40" or 40rad" or "+=40deg" to a numeric radian angle, optionally relative to a default value (if "+=" or "-=" prefix is found)
221			_parseAngle = function(v, d) { 
222				var m = (v.indexOf("rad") === -1) ? _DEG2RAD : 1, 
223					r = (v.indexOf("=") === 1);
224				v = Number(v.replace(_NaNExp, "")) * m;
225				return r ? v + d : v;
226			},
227			_colorLookup = {aqua:[0,255,255],
228							lime:[0,255,0],
229							silver:[192,192,192],
230							black:[0,0,0],
231							maroon:[128,0,0],
232							teal:[0,128,128],
233							blue:[0,0,255],
234							navy:[0,0,128],
235							white:[255,255,255],
236							fuchsia:[255,0,255],
237							olive:[128,128,0],
238							yellow:[255,255,0],
239							orange:[255,165,0],
240							gray:[128,128,128],
241							purple:[128,0,128],
242							green:[0,128,0],
243							red:[255,0,0],
244							pink:[255,192,203],
245							cyan:[0,255,255],
246							transparent:[255,255,255,0]};
247							
248		
249		//gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc. 
250		p._onInitTween = function(target, value, tween) {
251			this._style = target;
252			this._tween = tween;
253			this._transform = null; //_transform is only used for scaleX/scaleY/x/y/rotation/skewX/skewY tweens
254			this._parseVars(value, target, value.suffixMap || CSSRulePlugin.suffixMap);
255			return true;
256		}
257		
258		//feed a vars object to this function and it will parse through its properties and add PropTweens as necessary. This is split out from the _onInitTween() so that we can recurse if necessary, like "margin" should affect "marginLeft", "marginRight", "marginTop", and "marginBottom".
259		p._parseVars = function(vars, s, map) {
260			var p, v, pt, beg, clr1, clr2, bsfx, esfx, rel, start, copy;
261			
262			for (p in vars) {
263				
264				v = vars[p];
265				
266				if (p === "transform" || p === _transformProp) {
267					this._parseTransform(s, v, map);
268					continue;
269				} else if (_transformMap[p] || p === "transformOrigin") {
270					this._parseTransform(s, vars, map);
271					continue;
272				} else if (p === "alpha" || p === "autoAlpha") { //alpha tweens are opacity tweens			
273					p = "opacity";
274				} else if (p === "margin" || p === "padding") {
275					copy = (v + "").split(" ");
276					rel = copy.length;
277					pt = {};
278					pt[p + "Top"] = copy[0];
279					pt[p + "Right"] = (rel > 1) ? copy[1] : copy[0];
280					pt[p + "Bottom"] = (rel === 4) ? copy[2] : copy[0];
281					pt[p + "Left"] = (rel === 4) ? copy[3] : (rel === 2) ? copy[1] : copy[0];
282					this._parseVars(pt, s, map);
283					continue;
284				} else if (p === "backgroundPosition" || p === "backgroundSize") {
285					pt = _parsePosition(v); //end values 
286					start = _parsePosition( (beg = s[p] || "50% 50%") ); //starting values
287					this._firstPT = pt = {_next:this._firstPT, t:s, p:p, b:beg, f:false, n:"css_" + p, type:3,
288							s:start.ox, //x start
289							c:pt.oxr ? pt.ox : pt.ox - start.ox, //change in x
290							ys:start.oy, //y start
291							yc:pt.oyr ? pt.oy : pt.oy - start.oy, //change in y
292							sfx:pt.oxp ? "%" : "px", //x suffix
293							ysfx:pt.oyp ? "%" : "px", //y suffix
294							r:(!pt.oxp && vars.autoRound !== false)};
295					pt.e = (pt.s + pt.c) + pt.sfx + " " + (pt.ys + pt.yc) + pt.ysfx;
295 //we can't just use v because it could contain relative values, like +=50px which is an illegal final value.
296					continue;
297				} else if (p === "border") {
298					copy = (v + "").split(" ");
299					this._parseVars({borderWidth:copy[0], borderStyle:copy[1] || "none", borderColor:copy[2] || "#000000"}, s, map);
300					continue;
301				} else if (p === "autoRound") {
302					continue;
303				}
304
305				beg = s[p]; 
306				beg = (beg != null) ? beg + "" : ""; 
307				
308				//Some of these properties are in place in order to conform with the standard PropTweens in TweenPlugins so that overwriting and roundProps occur properly. For example, f and r may seem unnecessary here, but they enable other functionality.
309				//_next:*	next linked list node		[object]
310				//t: 	*	target 						[object]
311				//p:	*	property (camelCase)		[string]
312				//s: 	*	starting value				[number]
313				//c:	*	change value				[number]
314				//f:	* 	is function					[boolean]
315				//n:	*	name (for overwriting)		[string]
316				//sfx:		suffix						[string]
317				//b:		beginning value				[string]
318				//i:		intermediate value			[string]
319				//e: 		ending value				[string]
320				//r:	*	round						[boolean]
321				//type:		0=normal, 1=color, 2=rgba, 3=positional offset (like backgroundPosition or backgroundSize), 4=unsupported opacity (ie), -1=non-tweening prop	[number]
322				this._firstPT = pt = {_next:this._firstPT, 
323					  t:s, 
324					  p:p, 
325					  b:beg,	 
326					  f:false,
327					  n:"css_" + p,
328					  sfx:"",
329					  r:false,
330					  type:0};
331					  
332				//if it's an autoAlpha, add a new PropTween for "visibility". We must make sure the "visibility" PropTween comes BEFORE the "opacity" one in order to work around a bug in old versions of IE tht would ignore "visibility" changes if made right after an alpha change. Remember, we add PropTweens in reverse order - that's why we do this here, after creating the original PropTween.
333				if (p === "opacity") if (vars.autoAlpha != null) {
334					this._firstPT = pt._prev = {_next:pt, t:s, p:"visibility", f:false, n:"css_visibility", r:false, type:-1, b:(Number(beg) !== 0) ? "visible" : "hidden", i:"visible", e:(Number(v) === 0) ? "hidden" : "visible"};
335					this._overwriteProps.push("css_visibility");
336				}
337									
338				//color values must be split apart into their R, G, B (and sometimes alpha) values and tweened independently.
339				if (p === "color" || p === "fill" || p === "stroke" || p.indexOf("Color") !== -1 || (typeof(v) === "string" && !v.indexOf("rgb("))) { //Opera uses background: to define color sometimes in addition to backgroundColor:
340					clr1 = _parseColor(beg);
341					clr2 = _parseColor(v);
342					pt.e = v;
343					pt.s = Number(clr1[0]);				//red starting value
344					pt.c = Number(clr2[0]) - pt.s;		//red change
345					pt.gs = Number(clr1[1]);			//green starting value
346					pt.gc = Number(clr2[1]) - pt.gs;	//green change
347					pt.bs = Number(clr1[2]);			//blue starting value
348					pt.bc = Number(clr2[2]) - pt.bs;	//blue change
349					if (clr1.length > 3 || clr2.length > 3) { //detect an rgba() value
350						pt.as = (clr1.length < 4) ? 1 : Number(clr1[3]);
351						pt.ac = ((clr2.length < 4) ? 1 : Number(clr2[3])) - pt.as;
352						pt.type = (pt.c || pt.gc || pt.bc || pt.ac) ? 2 : -1; //2 = rgba() tween, -1 = no tween, just set the value at the end
353					} else {
354						pt.type = (pt.c || pt.gc || pt.bc) ? 1 : -1; //1 = color tween, -1 = no tween, just set the value at the end because there's no changes
355					}
356					
357				} else {
358					
359					bsfx = beg.replace(_suffixExp, ""); //beginning suffix
360					
361					if (beg === "" || beg === "auto") {
362						start = (p !== "opacity") ? 0 : 1;
363					} else {
364						start = (beg.indexOf(" ") === -1) ? parseFloat(beg.replace(_NaNExp, "")) : NaN;
365					}
366					
367					if (typeof(v) === "string") {
368						rel = (v.charAt(1) === "=");
369						esfx = v.replace(_suffixExp, "");
370						v = (v.indexOf(" ") === -1) ? parseFloat(v.replace(_NaNExp, "")) : NaN;
371					} else {
372						rel = false;
373						esfx = "";
374					}
375					
376					if (esfx === "") {
377						esfx = map[p] || bsfx; //populate the end suffix, prioritizing the map, then if none is found, use the beginning suffix.
378					}
379					
380					pt.e = (v || v === 0) ? (rel ? v + start : v) + 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.
381
382					//if the beginning/ending suffixes don't match, normalize them...
383					if (bsfx !== esfx) if (esfx !== "") if (v || v === 0) if (start || start === 0) { 
384						throw("CSSRulePlugin error: starting and ending units don't match on tween of " + p + " (" + bsfx + " vs " + esfx + ")");
385					}
386					
387					if ((start || start === 0) && (v || v === 0) && (pt.c = (rel ? v : v - start))) { //faster than isNaN(). Also, we set pt.c (change) here because if it's 0, we'll just treat it like a non-tweening value. can't do (v !== start) because if it's a relative value and the CHANGE is identical to the START, the condition will fail unnecessarily.
388						pt.s = start;
389						pt.sfx = esfx;
390						if (p === "opacity") {
391							if (!_supportsOpacity) {
392								pt.type = 4;
393								pt.p = "filter";
394								pt.b = "alpha(opacity=" + (pt.s * 100) + ")";
395								pt.e = "alpha(opacity=" + ((pt.s + pt.c) * 100) + ")";
396								pt.dup = (vars.autoAlpha != null); //dup = duplicate the setting of the alpha in order to work around a bug in IE7 and IE8 that prevents changes to "visibility" from taking effect if the filter is changed to a different alpha(opacity) at the same time. Setting it to the SAME value first, then the new value works around the IE7/8 bug.
397								this._style.zoom = 1; //helps correct an IE issue.
398							}
399						} else if (vars.autoRound !== false && (esfx === "px" || p === "zIndex")) { //always round zIndex, and as long as autoRound isn't false, round pixel values (that improves performance in browsers typically)
400							pt.r = true;
401						}
402					} else {
403						pt.type = -1;
404						pt.i = pt.e; //intermediate value is typically the same as the end value.
405						pt.s = pt.c = 0;
406					}
407					
408				}
409				
410				this._overwriteProps.push("css_" + p);
411				if (pt._next) {
412					pt._next._prev = pt;
413				}
414			}
415			
416		}
417		
418		
419		//compares the beginning x, y, scaleX, scaleY, rotation, and skewX properties with the ending ones and adds PropTweens accordingly wherever necessary. We must tween them individually (rather than just tweening the matrix values) so that elgant overwriting can occur, like if one tween is controlling scaleX, scaleY, and rotation and then another one starts mid-tween that is trying to control the scaleX only - this tween should continue tweening scaleY and rotation.
420		p._parseTransform = function(s, v, map) {
421			if (this._transform) { return; } //only need to parse the transform once, and only if the browser supports it.
422			
423			var m1 = this._transform = _getTransform(s, true), 
424				min = 0.000001,
425				m2, skewY, p, pt, copy, orig;
426			
427			if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object)
428
429				m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX),
430					  scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY),
431					  x:_parseVal(v.x, m1.x),
432					  y:_parseVal(v.y, m1.y)};
433					  
434				if (v.shortRotation != null) {
435					m2.rotation = (typeof(v.shortRotation) === "number") ? v.shortRotation * _DEG2RAD : _parseAngle(v.shortRotation, m1.rotation);
436					var dif = (m2.rotation - m1.rotation) % (Math.PI * 2);
437					if (dif !== dif % Math.PI) {
438						dif += Math.PI * ((dif < 0) ? 2 : -2);
439					}
440					m2.rotation = m1.rotation + dif;
441					
442				} else {
443					m2.rotation = (v.rotation == null) ? m1.rotation : (typeof(v.rotation) === "number") ? v.rotation * _DEG2RAD : _parseAngle(v.rotation, m1.rotation);
444				}
445				m2.skewX = (v.skewX == null) ? m1.skewX : (typeof(v.skewX) === "number") ? v.skewX * _DEG2RAD : _parseAngle(v.skewX, m1.skewX);
446				
447				//note: for performance reasons, we combine all skewing into the skewX and rotation values, ignoring skewY but we must still record it so that we can discern how much of the overall skew is attributed to skewX vs. skewY. Otherwise, if the skewY would always act relative (tween skewY to 10deg, for example, multiple times and if we always combine things into skewX, we can't remember that skewY was 10 from last time). Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of -10 degrees.
448				m2.skewY = (v.skewY == null) ? m1.skewY : (typeof(v.skewY) === "number") ? v.skewY * _DEG2RAD : _parseAngle(v.skewY, m1.skewY);
449				if ((skewY = m2.skewY - m1.skewY)) {
450					m2.skewX += skewY
451					m2.rotation += skewY;
452				}
453				//don't allow rotation/skew values to be a SUPER small decimal because when they're translated back to strings for setting the css property, the browser reports them in a funky way, like 1-e7. Of course we could use toFixed() to resolve that issue but that hurts performance quite a bit with all those function calls on every frame, plus it is virtually impossible to discern values that small visually (nobody will notice changing a rotation of 0.0000001 to 0, so the performance improvement is well worth it).
454				if (m2.skewY < min) if (m2.skewY > -min) {
455					m2.skewY = 0;
456				}
457				if (m2.skewX < min) if (m2.skewX > -min) {
458					m2.skewX = 0;
459				}
460				if (m2.rotation < min) if (m2.rotation > -min) {
461					m2.rotation = 0;
462				}
463				
464				//if a transformOrigin is defined, handle it here...
465				if ((orig = v.transformOrigin) != null) {
466					if (_transformProp) {
467						p = _transformProp + "Origin";
468						this._firstPT = pt = {_next:this._firstPT, t:s, p:p, s:0, c:0, n:p, f:false, r:false, b:s[p], e:orig, i:orig, type:-1, sfx:""};
469						if (pt._next) {
470							pt._next._prev = pt;
471						}
472					
473					//for older versions of IE (6-8), we need to manually calculate things inside the setRatio() function. We record origin x and y (ox and oy) and whether or not the values are percentages (oxp and oyp). 
474					} else {
475						_parsePosition(orig, m1);
476					}
477				}
478				
479			} else if (typeof(v) === "string" && _transformProp) { //for values like transform:"rotate(60deg) scale(0.5, 0.8)"
480				copy = s[_transformProp];
481				s[_transformProp] = v;
482				m2 = _getTransform(s, false);
483				s[_transformProp] = copy;
484			} else {
485				return;
486			}
487			
488			if (!_transformProp) {
489				s.zoom = 1; //helps correct an IE issue.
490			} else if (_transformProp === "WebkitTransform") {
491				s[_transformProp + "Style"] = "preserve-3d"; //corrects a bug in Safari that causes it to skip rendering changes to "top" and "left" that are made on the same frame/render as a transform update.
492			}
493			
494			for (p in _transformMap) {
495				if (m1[p] !== m2[p]) if (p !== "shortRotation") if (p !== "scale") {
496					this._firstPT = pt = {_next:this._firstPT, t:m1, p:p, s:m1[p], c:m2[p] - m1[p], n:p, f:false, r:false, b:m1[p], e:m2[p], type:0, sfx:0};
497					if (pt._next) {
498						pt._next._prev = pt;
499					}
500					this._overwriteProps.push("css_" + p);
501				}
502			}
503		};
504		
505		
506		//gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1.
507		p.setRatio = function(v) {
508			var pt = this._firstPT, 
509				min = 0.000001, val, y;
510			
511			//at the end of the tween, we set the values to exactly what we received in order to make sure non-tweening values (like "position" or "float" or whatever) are set and so that if the beginning/ending suffixes (units) didn't match and we normalized to px, the value that the user passed in is used here. We check to see if the tween is at its beginning in case it's a from() tween in which case the ratio will actually go from 1 to 0 over the course of the tween (backwards). 
512			if (v === 1 && (this._tween._time === this._tween._duration || this._tween._time === 0)) {
513				while (pt) {
514					pt.t[pt.p] = pt.e;
515					pt = pt._next;
516				}
517			
518			} else if (v || !(this._tween._time === this._tween._duration || this._tween._time === 0)) {
519				
520				while (pt) {
521					val = pt.c * v + pt.s;
522					if (pt.r) {
523						val = (val > 0) ? (val + 0.5) >> 0 : (val - 0.5) >> 0; 
524					} else if (val < min) if (val > -min) {
525						val = 0;
526					}
527					if (!pt.type) {
528						pt.t[pt.p] = val + pt.sfx;
529					} else if (pt.type === 1) { //rgb()
530						pt.t[pt.p] = "rgb(" + (val >> 0) + ", " + ((pt.gs + (v * pt.gc)) >>
530 0) + ", " + ((pt.bs + (v * pt.bc)) >> 0) + ")";
531					} else if (pt.type === 2) { //rgba()
532						pt.t[pt.p] = "rgba(" + (val >> 0) + ", " + ((pt.gs + (v * pt.gc)) >> 0) + ", " + ((pt.bs + (v * pt.bc)) >> 0) + ", " + (pt.as + (v * pt.ac)) + ")";
533					} else if (pt.type === -1) { //non-tweening
534						pt.t[pt.p] = pt.i;
535					} else if (pt.type === 3) { //positional property with an x and y, like backgroundPosition or backgroundSize
536						y = pt.ys + v * pt.yc;
537						if (pt.r) {
538							y = (y > 0) ? (y + 0.5) >> 0 : (y - 0.5) >> 0; 
539						}
540						pt.t[pt.p] = val + pt.sfx + " " + y + pt.ysfx;						
541					} else {
542						if (pt.dup) {
543							pt.t.filter = pt.t.filter || "alpha(opacity=100)"; //works around bug in IE7/8 that prevents changes to "visibility" from being applied propertly if the filter is changed to a different alpha on the same frame.
544						}
545						if (pt.t.filter.indexOf("opacity=") === -1) { //only used if browser doesn't support the standard opacity style property (IE 7 and 8)
546							pt.t.filter += " alpha(opacity=" + ((val * 100) >> 0) + ")"; //we round the value because otherwise, bugs in IE7/8 can prevent "visibility" changes from being applied properly.
547						} else {
548							pt.t.filter = pt.t.filter.replace(_opacityExp, "opacity=" + ((val * 100) >> 0)); //we round the value because otherwise, bugs in IE7/8 can prevent "visibility" changes from being applied properly.
549						}
550					}
551					pt = pt._next;
552				}
553				
554			//if the tween is reversed all the way back to the beginning, we need to restore the original values which may have different units (like % instead of px or em or whatever).
555			} else {
556				while (pt) {
557					pt.t[pt.p] = pt.b;
558					pt = pt._next;
559				}
560			}
561			
562			//apply transform values like x, y, scaleX, scaleY, rotation, skewX, or skewY. We do these after looping through all the PropTweens because those are where the changes are made to scaleX
562/scaleY/rotation/skewX/skewY/x/y.
563			if (this._transform) {
564				pt = this._transform; //to improve speed and reduce size, reuse the pt variable as an alias to the _transform property
565				//if there is no rotation, browsers render the transform faster if we just feed it the list of transforms like translate() skewX() scale(), otherwise defining the matrix() values directly is fastest.
566				if (_transformProp && !pt.rotation) {
567					this._style[_transformProp] = ((pt.x || pt.y) ? "translate(" + pt.x + "px," + pt.y + "px) " : "") + (pt.skewX ? "skewX(" + pt.skewX + "rad) " : "") + ((pt.scaleX !== 1 || pt.scaleY !== 1) ? "scale(" + pt.scaleX + "," + (Math.cos(pt.skewX) * pt.scaleY) + ")" : "") || "translate(0px,0px)"; //we need to default to translate(0px,0px) to work around a Chrome bug that rears its ugly head when the transform is set to "".
568				} else {
569					var ang = _transformProp ? pt.rotation : -pt.rotation, 
570						skew = _transformProp ? ang - pt.skewX : ang + pt.skewX,
571						a = Math.cos(ang) * pt.scaleX,
572						b = Math.sin(ang) * pt.scaleX,
573						c = Math.sin(skew) * -pt.scaleY,
574						d = Math.cos(skew) * pt.scaleY;
575					//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 for both b and c. The conditional logic here is faster than calling Math.abs().
576					if (b < min) if (b > -min) {
577						b = 0;
578					}
579					if (c < min) if (c > -min) {
580						c = 0;
581					}
582					if (_transformProp) {
583						this._style[_transformProp] = "matrix(" + a + "," + b + "," + c + "," + d + "," + pt.x + "," + pt.y + ")";
584						
585					//only for older versions of IE (6-8), we use a filter and marginLeft/marginTop to simulate the transform.
586					} else {
587						min = b; //just for swapping the variables an inverting them (reused "min" to avoid creating another variable in memory). IE's filter matrix uses a non-standard matrix configuration (angle goes the opposite way, and b and c are reversed and inverted)
588						b = -c;
589						c = -min;
590						var filters = this._style.filter;
591						this._style.filter = ""; //remove filters so that we can accurately measure offsetWidth/offsetHeight
592						var clip = (this._style.position !== "absolute"),
593							m = "progid:DXImageTransform.Microsoft.Matrix(M11=" + a + ", M12=" + b + ", M21=" + c + ", M22=" + d + ",sizingMethod='auto expand')",
594							ox = pt.x,
595							oy = pt.y,
596							dx, dy;
597						
598						if (filters.indexOf("progid:DXImageTransform.Microsoft.Matrix(") !== -1) {
599							this._style.filter = filters.replace(_ieSetMatrixExp, m);
600						} else {
601							this._style.filter = filters + " " + m;
602						}
603					}
604				}
605			}
606			
607		}
608		
609		//we need to make sure that if alpha or autoAlpha is killed, opacity is too. And autoAlpha affects the "visibility" property.
610		p._kill = function(lookup) {
611			var copy = lookup, p;
612			if (lookup.autoAlpha || lookup.alpha) {
613				copy = {};
614				for (p in lookup) { //copy the lookup so that we're not changing the original which may be passed elsewhere.
615					copy[p] = lookup[p];
616				}
617				copy.opacity = 1;
618				if (copy.autoAlpha) {
619					copy.visibility = 1;
620				}
621			}
622			return TweenPlugin.prototype._kill.call(this, copy);
623		}
624		
625		
626		TweenPlugin.activate([CSSRulePlugin]);
627		return CSSRulePlugin;
628		
629	}, true);
630	
631}); if (window._gsDefine) { _gsQueue.pop()(); }

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.