diff --git a/demos/demo2/helix.js b/demos/demo2/helix.js index 39f1c1bb..48bce345 100644 --- a/demos/demo2/helix.js +++ b/demos/demo2/helix.js @@ -11,95 +11,94 @@ ,updateHandle ,isPlaying ,i; - + function now () { return +(new Date()); } - + function getPosition (loopPosition, startBuffer) { var moddedLoopPosition ,interpolator ,interpolatedValue; - + if ((loopPosition - startBuffer) < 0) { return 0; } - + interpolator = moddedLoopPosition = ((loopPosition - startBuffer) % 2); - + if (moddedLoopPosition > 1) { interpolator = moddedLoopPosition - 1; - } - + } + interpolatedValue = global.Tweenable.util.interpolate({ from: { 'left': 0 - ,'color': '#f00' }, to: { - 'left': HELIX_WIDTH - ,'color': '#00f' + 'left': HELIX_WIDTH }, position: interpolator, easing: 'easeInOutSine' }); - + if (moddedLoopPosition > 1) { return { 'left': HELIX_WIDTH - interpolatedValue.left - ,'color': interpolatedValue.color } } else { return interpolatedValue; } } - + function updateSegment (index, loopPosition) { var segment ,calculated; - + segment = segments[index]; calculated = getPosition(loopPosition, index * SEGMENT_BUFFER); - segment.style.left = calculated.left + 'px'; - //segment.style.background = calculated.color; + + var style = segment.style; + style.MozTransform = style.webkitTransform = + 'translateX(' + parseFloat(calculated.left) + 'px)'; } - + function updateSegments (startTime, callback) { var i ,timeDelta ,normalizedTime; - + timeDelta = now() - startTime; normalizedTime = timeDelta / CYCLE_SPEED; - + for (i = 0; i < segments.length; i++) { updateSegment(i, normalizedTime); } - + callback(); } - + function loop () { updateHandle = setTimeout(function () { updateSegments(startTime, loop); }, 1000 / 60); } - + function pause () { if (isPlaying === false) { return; } - + isPlaying = false; pausedAtTime = Tweenable.util.now(); clearTimeout(updateHandle); } - + function play () { if (isPlaying === true) { return; } - + isPlaying = true; startTime = Tweenable.util.now() - (pausedAtTime - startTime); loop(); @@ -110,11 +109,11 @@ segmentContainer = document.getElementById(containerId); segments = segmentContainer.children; stepStateLists = []; - + for (i = 0; i < segments.length; i++) { stepStateLists.push([]) } - + window.pause = pause; window.play = play; } diff --git a/dist/shifty.js b/dist/shifty.js index 40cda758..5288a125 100644 --- a/dist/shifty.js +++ b/dist/shifty.js @@ -2,7 +2,7 @@ * Shifty * Author: Jeremy Kahn - jeremyckahn@gmail.com * License: MIT - * Version: 0.5.6 (Tue, 31 Jan 2012 06:25:32 GMT) + * Version: 0.6.0 (Mon, 16 Apr 2012 03:00:56 GMT) */ ;(function(){ @@ -1118,12 +1118,11 @@ MIT Lincense. This code free to use, modify, distribute and enjoy. (function () { - var R_CSS_UNITS = /(px|em|%|pc|pt|mm|cm|in|ex)/i, - R_QUICK_CSS_UNITS = /([a-z]|%)/gi, - savedTokenProps; + var R_FORMAT = /\D+/g; + var savedTokenProps; function isValidString (str) { - return typeof str === 'string' && R_CSS_UNITS.test(str); + return typeof str === 'string' && str.match(R_FORMAT); } function getTokenProps (obj) { @@ -1132,10 +1131,16 @@ MIT Lincense. This code free to use, modify, distribute and enjoy. collection = {}; Tweenable.util.each(obj, function (obj, prop) { - if (isValidString(obj[prop])) { - collection[prop] = { - 'suffix': obj[prop].match(R_CSS_UNITS)[0] - }; + var rawString = obj[prop]; + + if (isValidString(rawString)) { + var templateChunks = rawString.match(R_FORMAT); + + if (templateChunks.length === 1) { + templateChunks.unshift(''); + } + + collection[prop] = templateChunks; } }); @@ -1145,13 +1150,14 @@ MIT Lincense. This code free to use, modify, distribute and enjoy. function deTokenize (obj, tokenProps) { Tweenable.util.each(tokenProps, function (collection, token) { // Extract the value from the string - obj[token] = +(obj[token].replace(R_QUICK_CSS_UNITS, '')); + obj[token] = +(obj[token].replace(R_FORMAT, '')); }); } function reTokenize (obj, tokenProps) { Tweenable.util.each(tokenProps, function (collection, token) { - obj[token] = obj[token] + collection[token].suffix; + var tokenChunks = collection[token]; + obj[token] = tokenChunks[0] + obj[token] + tokenChunks[1]; }); } diff --git a/dist/shifty.min.js b/dist/shifty.min.js index 9191bdaf..784c340a 100644 --- a/dist/shifty.min.js +++ b/dist/shifty.min.js @@ -2,6 +2,6 @@ * Shifty * Author: Jeremy Kahn - jeremyckahn@gmail.com * License: MIT - * Version: 0.5.6 (Tue, 31 Jan 2012 06:25:32 GMT) + * Version: 0.6.0 (Mon, 16 Apr 2012 03:00:56 GMT) */ -(function(){var a;(function(b){function f(a,b){var c;for(c in a)a.hasOwnProperty(c)&&b(a,c)}function g(a,b){return f(b,function(b,c){a[c]=b[c]}),a}function h(a,b){return f(b,function(b,c){typeof a[c]=="undefined"&&(a[c]=b[c])}),a}function i(a,b,c){var d,f;f=(a-b.timestamp)/b.duration;for(d in c.current)c.current.hasOwnProperty(d)&&b.to.hasOwnProperty(d)&&(c.current[d]=j(b.originalState[d],b.to[d],e[b.easing[d]],f));return c.current}function j(a,b,c,d){return a+(b-a)*c(d)}function k(a,b){return setTimeout(a,1e3/b)}function l(a,b,c,d){var e;for(e=0;e=d;b.isTweening&&(f||(b.loopId=k(function(){n(a,b)},a.owner.fps)),m("beforeTween",a.owner,[b.current,a.originalState,a.to]),i(e,a,b),m("afterTween",a.owner,[b.current,a.originalState,a.to]),a.hook.step&&l("step",a.hook,a.owner,[b.current]),a.step&&a.step.call(b.current,b.current)),(f||!b.isTweening)&&a.owner.stop(!0)}function o(a,b){var c;return c={},typeof b=="string"?f(a,function(a,d){c[d]=b}):f(a,function(a,e){c[e]||(c[e]=b[e]||d)}),c}var c,d="linear",e;typeof SHIFTY_DEBUG_NOW=="function"?c=SHIFTY_DEBUG_NOW:c=function(){return+(new Date)},typeof SHIFTY_DEBUG_NOW=="function"&&(b.timeoutHandler=n),a=function(a){return a=a||{},this._hook={},this._tweenParams={owner:this,hook:this._hook,data:{}},this._state={},this._state.current=a.initialState||{},this.fps=a.fps||30,this.easing=a.easing||d,this.duration=a.duration||500,this},a.prototype.tween=function(a,b,d,e,f){var i,j,k;if(this._state.isTweening)return;return i=this,j=this._tweenParams,k=this._state,this._state.loopId=0,this._state.pausedAtTime=null,b?(j.to=b||{},j.duration=d||this.duration,j.callback=e,j.easing=f||this.easing,k.current=a||{}):(j.step=a.step,j.callback=a.callback,j.to=a.to||a.target||{},j.duration=a.duration||this.duration,j.easing=a.easing||this.easing,k.current=a.from||{}),j.timestamp=c(),h(k.current,j.to),h(j.to,k.current),j.easing=o(k.current,j.easing),m("tweenCreated",j.owner,[k.current,j.originalState,j.to]),j.originalState=g({},k.current),k.isTweening=!0,this.resume(),a.start&&a.start(),this},a.prototype.to=function(b,c,d,e){return arguments.length===1?"to"in b?(b.from=this.get(),this.tween(b)):this.tween(this.get(),b):this.tween(this.get(),b,c,d,e),this},a.prototype.get=function(){return this._state.current},a.prototype.set=function(a){return this._state.current=a||{},this},a.prototype.stop=function(a){return clearTimeout(this._state.loopId),this._state.isTweening=!1,a&&(g(this._state.current,this._tweenParams.to),m("afterTweenEnd",this,[this._state.current,this._tweenParams.originalState,this._tweenParams.to]),this._tweenParams.callback&&this._tweenParams.callback.call(this._state.current,this._state.current)),this},a.prototype.pause=function(){return clearTimeout(this._state.loopId),this._state.pausedAtTime=c(),this._state.isPaused=!0,this},a.prototype.resume=function(){var a;return a=this,this._state.isPaused&&(this._tweenParams.timestamp+=c()-this._state.pausedAtTime),n(a._tweenParams,a._state),this},a.prototype.hookAdd=function(a,b){this._hook.hasOwnProperty(a)||(this._hook[a]=[]),this._hook[a].push(b)},a.prototype.hookRemove=function(a,b){var c;if(!this._hook.hasOwnProperty(a))return;if(!b){this._hook[a]=[];return}for(c=this._hook[a].length;c>=0;c++)this._hook[a][c]===b&&this._hook[a].splice(c,1)},a.prototype.filter={},a.util={now:c,each:f,tweenProps:i,tweenProp:j,applyFilter:m,simpleCopy:g,weakCopy:h,composeEasingObject:o},e=a.prototype.formula={linear:function(a){return a}},typeof exports=="object"?module.exports=a:typeof define=="function"&&define.amd?define(function(){return a}):typeof b.Tweenable=="undefined"&&(b.Tweenable=a)})(this),function(){a.util.simpleCopy(a.prototype.formula,{easeInQuad:function(a){return Math.pow(a,2)},easeOutQuad:function(a){return-(Math.pow(a-1,2)-1)},easeInOutQuad:function(a){return(a/=.5)<1?.5*Math.pow(a,2):-0.5*((a-=2)*a-2)},easeInCubic:function(a){return Math.pow(a,3)},easeOutCubic:function(a){return Math.pow(a-1,3)+1},easeInOutCubic:function(a){return(a/=.5)<1?.5*Math.pow(a,3):.5*(Math.pow(a-2,3)+2)},easeInQuart:function(a){return Math.pow(a,4)},easeOutQuart:function(a){return-(Math.pow(a-1,4)-1)},easeInOutQuart:function(a){return(a/=.5)<1?.5*Math.pow(a,4):-0.5*((a-=2)*Math.pow(a,3)-2)},easeInQuint:function(a){return Math.pow(a,5)},easeOutQuint:function(a){return Math.pow(a-1,5)+1},easeInOutQuint:function(a){return(a/=.5)<1?.5*Math.pow(a,5):.5*(Math.pow(a-2,5)+2)},easeInSine:function(a){return-Math.cos(a*(Math.PI/2))+1},easeOutSine:function(a){return Math.sin(a*(Math.PI/2))},easeInOutSine:function(a){return-0.5*(Math.cos(Math.PI*a)-1)},easeInExpo:function(a){return a==0?0:Math.pow(2,10*(a-1))},easeOutExpo:function(a){return a==1?1:-Math.pow(2,-10*a)+1},easeInOutExpo:function(a){return a==0?0:a==1?1:(a/=.5)<1?.5*Math.pow(2,10*(a-1)):.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return-(Math.sqrt(1-a*a)-1)},easeOutCirc:function(a){return Math.sqrt(1-Math.pow(a-1,2))},easeInOutCirc:function(a){return(a/=.5)<1?-0.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)},easeOutBounce:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},easeInBack:function(a){var b=1.70158;return a*a*((b+1)*a-b)},easeOutBack:function(a){var b=1.70158;return(a-=1)*a*((b+1)*a+b)+1},easeInOutBack:function(a){var b=1.70158;return(a/=.5)<1?.5*a*a*(((b*=1.525)+1)*a-b):.5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},elastic:function(a){return-1*Math.pow(4,-8*a)*Math.sin((a*6-1)*2*Math.PI/2)+1},swingFromTo:function(a){var b=1.70158;return(a/=.5)<1?.5*a*a*(((b*=1.525)+1)*a-b):.5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},swingFrom:function(a){var b=1.70158;return a*a*((b+1)*a-b)},swingTo:function(a){var b=1.70158;return(a-=1)*a*((b+1)*a+b)+1},bounce:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},bouncePast:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?2-(7.5625*(a-=1.5/2.75)*a+.75):a<2.5/2.75?2-(7.5625*(a-=2.25/2.75)*a+.9375):2-(7.5625*(a-=2.625/2.75)*a+.984375)},easeFromTo:function(a){return(a/=.5)<1?.5*Math.pow(a,4):-0.5*((a-=2)*Math.pow(a,3)-2)},easeFrom:function(a){return Math.pow(a,4)},easeTo:function(a){return Math.pow(a,.25)}})}(),function(){function c(a){a.shift(),a.length?a[0]():a.running=!1}function d(a,b){return function(){a(),c(b)}}function e(a,b,c,d,e,f){return function(){c?a.tween(b,c,d,e,f):(b.callback=e,b.from?a.tween(b):a.to(b))}}var b=function(){};a.prototype.queue=function(a,c,f,g,h){var i;return this._tweenQueue||(this._tweenQueue=[]),g=g||a.callback||b,i=d(g,this._tweenQueue),this._tweenQueue.push(e(this,a,c,f,i,h)),this},a.prototype.queueStart=function(){return!this._tweenQueue.running&&this._tweenQueue.length>0&&(this._tweenQueue[0](),this._tweenQueue.running=!0),this},a.prototype.queueShift=function(){return this._tweenQueue.shift(),this},a.prototype.queuePop=function(){return this._tweenQueue.pop(),this},a.prototype.queueEmpty=function(){return this._tweenQueue.length=0,this},a.prototype.queueLength=function(){return this._tweenQueue.length}}(),function(){function f(a){return parseInt(a,16)}function g(a){return a=a.replace(/#/g,""),a.length===3&&(a=a.split(""),a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),[f(a.substr(0,2)),f(a.substr(2,2)),f(a.substr(4,2))]}function h(a){var b,c;return b=g(a),c="rgb("+b[0]+","+b[1]+","+b[2]+")",c}function i(a){return typeof a=="string"&&(b.test(a)||c.test(a)||d.test(a))}function j(a){return typeof a=="string"&&(b.test(a)||c.test(a))}function k(b){a.util.each(b,function(a,b){j(a[b])&&(a[b]=h(a[b]))})}function l(b){var c;return c=[],a.util.each(b,function(a,b){i(a[b])&&c.push(b)}),c}function m(a){return a.match(/(\d+)/g)}function n(a,b){var c,d,e;d=b.length;for(c=0;c=d;b.isTweening&&(f||(b.loopId=k(function(){n(a,b)},a.owner.fps)),m("beforeTween",a.owner,[b.current,a.originalState,a.to]),i(e,a,b),m("afterTween",a.owner,[b.current,a.originalState,a.to]),a.hook.step&&l("step",a.hook,a.owner,[b.current]),a.step&&a.step.call(b.current,b.current)),(f||!b.isTweening)&&a.owner.stop(!0)}function o(a,b){var c;return c={},typeof b=="string"?f(a,function(a,d){c[d]=b}):f(a,function(a,e){c[e]||(c[e]=b[e]||d)}),c}var c,d="linear",e;typeof SHIFTY_DEBUG_NOW=="function"?c=SHIFTY_DEBUG_NOW:c=function(){return+(new Date)},typeof SHIFTY_DEBUG_NOW=="function"&&(b.timeoutHandler=n),a=function(a){return a=a||{},this._hook={},this._tweenParams={owner:this,hook:this._hook,data:{}},this._state={},this._state.current=a.initialState||{},this.fps=a.fps||30,this.easing=a.easing||d,this.duration=a.duration||500,this},a.prototype.tween=function(a,b,d,e,f){var i,j,k;if(this._state.isTweening)return;return i=this,j=this._tweenParams,k=this._state,this._state.loopId=0,this._state.pausedAtTime=null,b?(j.to=b||{},j.duration=d||this.duration,j.callback=e,j.easing=f||this.easing,k.current=a||{}):(j.step=a.step,j.callback=a.callback,j.to=a.to||a.target||{},j.duration=a.duration||this.duration,j.easing=a.easing||this.easing,k.current=a.from||{}),j.timestamp=c(),h(k.current,j.to),h(j.to,k.current),j.easing=o(k.current,j.easing),m("tweenCreated",j.owner,[k.current,j.originalState,j.to]),j.originalState=g({},k.current),k.isTweening=!0,this.resume(),a.start&&a.start(),this},a.prototype.to=function(b,c,d,e){return arguments.length===1?"to"in b?(b.from=this.get(),this.tween(b)):this.tween(this.get(),b):this.tween(this.get(),b,c,d,e),this},a.prototype.get=function(){return this._state.current},a.prototype.set=function(a){return this._state.current=a||{},this},a.prototype.stop=function(a){return clearTimeout(this._state.loopId),this._state.isTweening=!1,a&&(g(this._state.current,this._tweenParams.to),m("afterTweenEnd",this,[this._state.current,this._tweenParams.originalState,this._tweenParams.to]),this._tweenParams.callback&&this._tweenParams.callback.call(this._state.current,this._state.current)),this},a.prototype.pause=function(){return clearTimeout(this._state.loopId),this._state.pausedAtTime=c(),this._state.isPaused=!0,this},a.prototype.resume=function(){var a;return a=this,this._state.isPaused&&(this._tweenParams.timestamp+=c()-this._state.pausedAtTime),n(a._tweenParams,a._state),this},a.prototype.hookAdd=function(a,b){this._hook.hasOwnProperty(a)||(this._hook[a]=[]),this._hook[a].push(b)},a.prototype.hookRemove=function(a,b){var c;if(!this._hook.hasOwnProperty(a))return;if(!b){this._hook[a]=[];return}for(c=this._hook[a].length;c>=0;c++)this._hook[a][c]===b&&this._hook[a].splice(c,1)},a.prototype.filter={},a.util={now:c,each:f,tweenProps:i,tweenProp:j,applyFilter:m,simpleCopy:g,weakCopy:h,composeEasingObject:o},e=a.prototype.formula={linear:function(a){return a}},typeof exports=="object"?module.exports=a:typeof define=="function"&&define.amd?define(function(){return a}):typeof b.Tweenable=="undefined"&&(b.Tweenable=a)})(this),function(){a.util.simpleCopy(a.prototype.formula,{easeInQuad:function(a){return Math.pow(a,2)},easeOutQuad:function(a){return-(Math.pow(a-1,2)-1)},easeInOutQuad:function(a){return(a/=.5)<1?.5*Math.pow(a,2):-0.5*((a-=2)*a-2)},easeInCubic:function(a){return Math.pow(a,3)},easeOutCubic:function(a){return Math.pow(a-1,3)+1},easeInOutCubic:function(a){return(a/=.5)<1?.5*Math.pow(a,3):.5*(Math.pow(a-2,3)+2)},easeInQuart:function(a){return Math.pow(a,4)},easeOutQuart:function(a){return-(Math.pow(a-1,4)-1)},easeInOutQuart:function(a){return(a/=.5)<1?.5*Math.pow(a,4):-0.5*((a-=2)*Math.pow(a,3)-2)},easeInQuint:function(a){return Math.pow(a,5)},easeOutQuint:function(a){return Math.pow(a-1,5)+1},easeInOutQuint:function(a){return(a/=.5)<1?.5*Math.pow(a,5):.5*(Math.pow(a-2,5)+2)},easeInSine:function(a){return-Math.cos(a*(Math.PI/2))+1},easeOutSine:function(a){return Math.sin(a*(Math.PI/2))},easeInOutSine:function(a){return-0.5*(Math.cos(Math.PI*a)-1)},easeInExpo:function(a){return a==0?0:Math.pow(2,10*(a-1))},easeOutExpo:function(a){return a==1?1:-Math.pow(2,-10*a)+1},easeInOutExpo:function(a){return a==0?0:a==1?1:(a/=.5)<1?.5*Math.pow(2,10*(a-1)):.5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return-(Math.sqrt(1-a*a)-1)},easeOutCirc:function(a){return Math.sqrt(1-Math.pow(a-1,2))},easeInOutCirc:function(a){return(a/=.5)<1?-0.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)},easeOutBounce:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},easeInBack:function(a){var b=1.70158;return a*a*((b+1)*a-b)},easeOutBack:function(a){var b=1.70158;return(a-=1)*a*((b+1)*a+b)+1},easeInOutBack:function(a){var b=1.70158;return(a/=.5)<1?.5*a*a*(((b*=1.525)+1)*a-b):.5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},elastic:function(a){return-1*Math.pow(4,-8*a)*Math.sin((a*6-1)*2*Math.PI/2)+1},swingFromTo:function(a){var b=1.70158;return(a/=.5)<1?.5*a*a*(((b*=1.525)+1)*a-b):.5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},swingFrom:function(a){var b=1.70158;return a*a*((b+1)*a-b)},swingTo:function(a){var b=1.70158;return(a-=1)*a*((b+1)*a+b)+1},bounce:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},bouncePast:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?2-(7.5625*(a-=1.5/2.75)*a+.75):a<2.5/2.75?2-(7.5625*(a-=2.25/2.75)*a+.9375):2-(7.5625*(a-=2.625/2.75)*a+.984375)},easeFromTo:function(a){return(a/=.5)<1?.5*Math.pow(a,4):-0.5*((a-=2)*Math.pow(a,3)-2)},easeFrom:function(a){return Math.pow(a,4)},easeTo:function(a){return Math.pow(a,.25)}})}(),function(){function c(a){a.shift(),a.length?a[0]():a.running=!1}function d(a,b){return function(){a(),c(b)}}function e(a,b,c,d,e,f){return function(){c?a.tween(b,c,d,e,f):(b.callback=e,b.from?a.tween(b):a.to(b))}}var b=function(){};a.prototype.queue=function(a,c,f,g,h){var i;return this._tweenQueue||(this._tweenQueue=[]),g=g||a.callback||b,i=d(g,this._tweenQueue),this._tweenQueue.push(e(this,a,c,f,i,h)),this},a.prototype.queueStart=function(){return!this._tweenQueue.running&&this._tweenQueue.length>0&&(this._tweenQueue[0](),this._tweenQueue.running=!0),this},a.prototype.queueShift=function(){return this._tweenQueue.shift(),this},a.prototype.queuePop=function(){return this._tweenQueue.pop(),this},a.prototype.queueEmpty=function(){return this._tweenQueue.length=0,this},a.prototype.queueLength=function(){return this._tweenQueue.length}}(),function(){function f(a){return parseInt(a,16)}function g(a){return a=a.replace(/#/g,""),a.length===3&&(a=a.split(""),a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),[f(a.substr(0,2)),f(a.substr(2,2)),f(a.substr(4,2))]}function h(a){var b,c;return b=g(a),c="rgb("+b[0]+","+b[1]+","+b[2]+")",c}function i(a){return typeof a=="string"&&(b.test(a)||c.test(a)||d.test(a))}function j(a){return typeof a=="string"&&(b.test(a)||c.test(a))}function k(b){a.util.each(b,function(a,b){j(a[b])&&(a[b]=h(a[b]))})}function l(b){var c;return c=[],a.util.each(b,function(a,b){i(a[b])&&c.push(b)}),c}function m(a){return a.match(/(\d+)/g)}function n(a,b){var c,d,e;d=b.length;for(c=0;c - +