parallaxis/duo/js/plugins/ColorPropsPlugin.min.js

13 lines
2.1 KiB
JavaScript
Executable File

/*!
* VERSION: beta 1.0
* DATE: 2012-06-19
* JavaScript
* UPDATES AND DOCS AT: http://www.greensock.com
*
* Copyright (c) 2008-2013, GreenSock. All rights reserved.
* This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for
* Club GreenSock members, the software agreement that was issued with your membership.
*
* @author: Jack Doyle, jack@greensock.com
*/
(window._gsQueue||(window._gsQueue=[])).push(function(){_gsDefine("plugins.ColorPropsPlugin",["plugins.TweenPlugin"],function(i){var g=function(){i.call(this,"colorProps",-1);this._overwriteProps.pop()},j=g.prototype=new i("colorProps",-1),l=/(\d|\.)+/g,k=function(a){return""===a||null==a||"none"===a?h.transparent:h[a]?h[a]:"number"===typeof a?[a>>16,a>>8&255,a&255]:"#"===a.charAt(0)?(4===a.length&&(a="#"+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2)+a.charAt(3)+a.charAt(3)),a=parseInt(a.substr(1), 16),[a>>16,a>>8&255,a&255]):a.match(l)||h.transparent},h={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],fuchsia:[255,0,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]};j.constructor=g;g.API=2;j._onInitTween=function(a,b){this._target=a;var d,e,f,c;for(d in b){f= k(b[d]);this._firstPT=c={_next:this._firstPT,p:d,f:"function"===typeof a[d],n:d,r:!1};e=k(!c.f?a[d]:a[d.indexOf("set")||"function"!==typeof a["get"+d.substr(3)]?d:"get"+d.substr(3)]());c.s=Number(e[0]);c.c=Number(f[0])-c.s;c.gs=Number(e[1]);c.gc=Number(f[1])-c.gs;c.bs=Number(e[2]);c.bc=Number(f[2])-c.bs;if(c.rgba=3<e.length||3<f.length)c.as=4>e.length?1:Number(e[3]),console.log("as "+c.as),c.ac=(4>f.length?1:Number(f[3]))-c.as;c._next&&(c._next._prev=c)}return!0};j.setRatio=function(a){for(var b= this._firstPT,d;b;){d=(b.rgba?"rgba(":"rgb(")+(b.s+a*b.c>>0)+", "+(b.gs+a*b.gc>>0)+", "+(b.bs+a*b.bc>>0)+(b.rgba?", "+(b.as+a*b.ac):"")+")";if(b.f)this._target[b.p](d);else this._target[b.p]=d;b=b._next}};i.activate([g]);return g},!0)});window._gsDefine&&_gsQueue.pop()();