1 // Spry.Effect.js - version 0.38 - Spry Pre-Release 1.6.1 |
|
2 // |
|
3 // Copyright (c) 2007. Adobe Systems Incorporated. |
|
4 // All rights reserved. |
|
5 // |
|
6 // Redistribution and use in source and binary forms, with or without |
|
7 // modification, are permitted provided that the following conditions are met: |
|
8 // |
|
9 // * Redistributions of source code must retain the above copyright notice, |
|
10 // this list of conditions and the following disclaimer. |
|
11 // * Redistributions in binary form must reproduce the above copyright notice, |
|
12 // this list of conditions and the following disclaimer in the documentation |
|
13 // and/or other materials provided with the distribution. |
|
14 // * Neither the name of Adobe Systems Incorporated nor the names of its |
|
15 // contributors may be used to endorse or promote products derived from this |
|
16 // software without specific prior written permission. |
|
17 // |
|
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
21 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
|
22 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
23 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
24 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
25 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
26 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
27 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
28 // POSSIBILITY OF SUCH DAMAGE. |
|
29 |
|
30 var Spry;if(!Spry)Spry={};Spry.forwards=1;Spry.backwards=2;if(!Spry.Effect)Spry.Effect={};Spry.Effect.Transitions={linearTransition:function(time,begin,change,duration) |
|
31 {if(time>duration)return change+begin;return begin+(time/duration)*change;},sinusoidalTransition:function(time,begin,change,duration) |
|
32 {if(time>duration)return change+begin;return begin+((-Math.cos((time/duration)*Math.PI)/2)+0.5)*change;},squareTransition:function(time,begin,change,duration) |
|
33 {if(time>duration)return change+begin;return begin+Math.pow(time/duration,2)*change;},squarerootTransition:function(time,begin,change,duration) |
|
34 {if(time>duration)return change+begin;return begin+Math.sqrt(time/duration)*change;},fifthTransition:function(time,begin,change,duration) |
|
35 {if(time>duration)return change+begin;return begin+Math.sqrt((-Math.cos((time/duration)*Math.PI)/2)+0.5)*change;},circleTransition:function(time,begin,change,duration) |
|
36 {if(time>duration)return change+begin;var pos=time/duration;return begin+Math.sqrt(1-Math.pow((pos-1),2))*change;},pulsateTransition:function(time,begin,change,duration) |
|
37 {if(time>duration)return change+begin;return begin+(0.5+Math.sin(17*time/duration)/2)*change;},growSpecificTransition:function(time,begin,change,duration) |
|
38 {if(time>duration)return change+begin;var pos=time/duration;return begin+(5*Math.pow(pos,3)-6.4*Math.pow(pos,2)+2*pos)*change;}};for(var trans in Spry.Effect.Transitions) |
|
39 {Spry[trans]=Spry.Effect.Transitions[trans];} |
|
40 Spry.Effect.Registry=function() |
|
41 {this.effects=[];};Spry.Effect.Registry.prototype.getRegisteredEffect=function(element,options) |
|
42 {var a={};a.element=Spry.Effect.getElement(element);a.options=options;for(var i=0;i<this.effects.length;i++) |
|
43 if(this.effectsAreTheSame(this.effects[i],a)) |
|
44 return this.effects[i].effect;return false;};Spry.Effect.Registry.prototype.addEffect=function(effect,element,options) |
|
45 {if(!this.getRegisteredEffect(element,options)) |
|
46 {var len=this.effects.length;this.effects[len]={};var eff=this.effects[len];eff.effect=effect;eff.element=Spry.Effect.getElement(element);eff.options=options;}};Spry.Effect.Registry.prototype.effectsAreTheSame=function(effectA,effectB) |
|
47 {if(effectA.element!=effectB.element) |
|
48 return false;var compare=Spry.Effect.Utils.optionsAreIdentical(effectA.options,effectB.options);if(compare) |
|
49 {if(typeof effectB.options.setup=='function') |
|
50 effectA.options.setup=effectB.options.setup;if(typeof effectB.options.finish=='function') |
|
51 effectA.options.finish=effectB.options.finish;} |
|
52 return compare;};var SpryRegistry=new Spry.Effect.Registry;if(!Spry.Effect.Utils)Spry.Effect.Utils={};Spry.Effect.Utils.showError=function(msg) |
|
53 {alert('Spry.Effect ERR: '+msg);};Spry.Effect.Utils.showInitError=function(effect){Spry.Effect.Utils.showError('The '+effect+' class can\'t be accessed as a static function anymore. '+"\n"+'Please read Spry Effects migration documentation.');return false;};Spry.Effect.Utils.Position=function() |
|
54 {this.x=0;this.y=0;this.units="px";};Spry.Effect.Utils.Rectangle=function() |
|
55 {this.width=0;this.height=0;this.units="px";};Spry.Effect.Utils.intToHex=function(integerNum) |
|
56 {var result=integerNum.toString(16);if(result.length==1) |
|
57 result="0"+result;return result;};Spry.Effect.Utils.hexToInt=function(hexStr) |
|
58 {return parseInt(hexStr,16);};Spry.Effect.Utils.rgb=function(redInt,greenInt,blueInt) |
|
59 {var intToHex=Spry.Effect.Utils.intToHex;var redHex=intToHex(redInt);var greenHex=intToHex(greenInt);var blueHex=intToHex(blueInt);compositeColorHex=redHex.concat(greenHex,blueHex).toUpperCase();compositeColorHex='#'+compositeColorHex;return compositeColorHex;};Spry.Effect.Utils.longColorVersion=function(color){if(color.match(/^#[0-9a-f]{3}$/i)){var tmp=color.split('');var color='#';for(var i=1;i<tmp.length;i++){color+=tmp[i]+''+tmp[i];}} |
|
60 return color;};Spry.Effect.Utils.camelize=function(stringToCamelize) |
|
61 {if(stringToCamelize.indexOf('-')==-1){return stringToCamelize;} |
|
62 var oStringList=stringToCamelize.split('-');var isFirstEntry=true;var camelizedString='';for(var i=0;i<oStringList.length;i++) |
|
63 {if(oStringList[i].length>0) |
|
64 {if(isFirstEntry) |
|
65 {camelizedString=oStringList[i];isFirstEntry=false;} |
|
66 else |
|
67 {var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}}} |
|
68 return camelizedString;};Spry.Effect.Utils.isPercentValue=function(value) |
|
69 {var result=false;if(typeof value=='string'&&value.length>0&&value.lastIndexOf("%")>0) |
|
70 result=true;return result;};Spry.Effect.Utils.getPercentValue=function(value) |
|
71 {var result=0;try |
|
72 {result=Number(value.substring(0,value.lastIndexOf("%")));} |
|
73 catch(e){Spry.Effect.Utils.showError('Spry.Effect.Utils.getPercentValue: '+e);} |
|
74 return result;};Spry.Effect.Utils.getPixelValue=function(value) |
|
75 {var result=0;if(typeof value=='number')return value;var unitIndex=value.lastIndexOf("px");if(unitIndex==-1) |
|
76 unitIndex=value.length;try |
|
77 {result=parseInt(value.substring(0,unitIndex),10);} |
|
78 catch(e){} |
|
79 return result;};Spry.Effect.Utils.getFirstChildElement=function(node) |
|
80 {if(node) |
|
81 {var childCurr=node.firstChild;while(childCurr) |
|
82 {if(childCurr.nodeType==1) |
|
83 return childCurr;childCurr=childCurr.nextSibling;}} |
|
84 return null;};Spry.Effect.Utils.fetchChildImages=function(startEltIn,targetImagesOut) |
|
85 {if(!startEltIn||startEltIn.nodeType!=1||!targetImagesOut) |
|
86 return;if(startEltIn.hasChildNodes()) |
|
87 {var childImages=startEltIn.getElementsByTagName('img');var imageCnt=childImages.length;for(var i=0;i<imageCnt;i++) |
|
88 {var imgCurr=childImages[i];var dimensionsCurr=Spry.Effect.getDimensions(imgCurr);targetImagesOut.push([imgCurr,dimensionsCurr.width,dimensionsCurr.height]);}}};Spry.Effect.Utils.optionsAreIdentical=function(optionsA,optionsB) |
|
89 {if(optionsA==null&&optionsB==null) |
|
90 return true;if(optionsA!=null&&optionsB!=null) |
|
91 {var objectCountA=0;var objectCountB=0;for(var propA in optionsA)objectCountA++;for(var propB in optionsB)objectCountB++;if(objectCountA!=objectCountB) |
|
92 return false;for(var prop in optionsA) |
|
93 {var typeA=typeof optionsA[prop];var typeB=typeof optionsB[prop];if(typeA!=typeB||(typeA!='undefined'&&optionsA[prop]!=optionsB[prop])) |
|
94 return false;} |
|
95 return true;} |
|
96 return false;};Spry.Effect.Utils.DoEffect=function(effectName,element,options) |
|
97 {if(!options) |
|
98 var options={};options.name=effectName;var ef=SpryRegistry.getRegisteredEffect(element,options);if(!ef) |
|
99 {ef=new Spry.Effect[effectName](element,options);SpryRegistry.addEffect(ef,element,options);} |
|
100 ef.start();return true;};if(!Spry.Utils)Spry.Utils={};Spry.Utils.Notifier=function() |
|
101 {this.observers=[];this.suppressNotifications=0;};Spry.Utils.Notifier.prototype.addObserver=function(observer) |
|
102 {if(!observer) |
|
103 return;var len=this.observers.length;for(var i=0;i<len;i++) |
|
104 if(this.observers[i]==observer)return;this.observers[len]=observer;};Spry.Utils.Notifier.prototype.removeObserver=function(observer) |
|
105 {if(!observer) |
|
106 return;for(var i=0;i<this.observers.length;i++) |
|
107 {if(this.observers[i]==observer) |
|
108 {this.observers.splice(i,1);break;}}};Spry.Utils.Notifier.prototype.notifyObservers=function(methodName,data) |
|
109 {if(!methodName) |
|
110 return;if(!this.suppressNotifications) |
|
111 {var len=this.observers.length;for(var i=0;i<len;i++) |
|
112 {var obs=this.observers[i];if(obs) |
|
113 {if(typeof obs=="function") |
|
114 obs(methodName,this,data);else if(obs[methodName]) |
|
115 obs[methodName](this,data);}}}};Spry.Utils.Notifier.prototype.enableNotifications=function() |
|
116 {if(--this.suppressNotifications<0) |
|
117 {this.suppressNotifications=0;Spry.Effect.Utils.showError("Unbalanced enableNotifications() call!\n");}};Spry.Utils.Notifier.prototype.disableNotifications=function() |
|
118 {++this.suppressNotifications;};Spry.Effect.getElement=function(ele) |
|
119 {var element=ele;if(typeof ele=="string") |
|
120 element=document.getElementById(ele);if(element==null) |
|
121 Spry.Effect.Utils.showError('Element "'+ele+'" not found.');return element;};Spry.Effect.getStyleProp=function(element,prop) |
|
122 {var value;var camelized=Spry.Effect.Utils.camelize(prop);try |
|
123 {if(element.style) |
|
124 value=element.style[camelized];if(!value) |
|
125 {if(document.defaultView&&document.defaultView.getComputedStyle) |
|
126 {var css=document.defaultView.getComputedStyle(element,null);value=css?css.getPropertyValue(prop):null;} |
|
127 else if(element.currentStyle) |
|
128 {value=element.currentStyle[camelized];}}} |
|
129 catch(e){Spry.Effect.Utils.showError('Spry.Effect.getStyleProp: '+e);} |
|
130 return value=='auto'?null:value;};Spry.Effect.setStyleProp=function(element,prop,value) |
|
131 {try |
|
132 {element.style[Spry.Effect.Utils.camelize(prop)]=value;} |
|
133 catch(e){Spry.Effect.Utils.showError('Spry.Effect.setStyleProp: '+e);}};Spry.Effect.getStylePropRegardlessOfDisplayState=function(element,prop,displayElement) |
|
134 {var refElement=displayElement?displayElement:element;var displayOrig=Spry.Effect.getStyleProp(refElement,'display');var visibilityOrig=Spry.Effect.getStyleProp(refElement,'visibility');if(displayOrig=='none') |
|
135 {Spry.Effect.setStyleProp(refElement,'visibility','hidden');Spry.Effect.setStyleProp(refElement,'display','block');if(window.opera) |
|
136 refElement.focus();} |
|
137 var styleProp=Spry.Effect.getStyleProp(element,prop);if(displayOrig=='none') |
|
138 {Spry.Effect.setStyleProp(refElement,'display','none');Spry.Effect.setStyleProp(refElement,'visibility',visibilityOrig);} |
|
139 return styleProp;};Spry.Effect.makePositioned=function(element) |
|
140 {var pos=Spry.Effect.getStyleProp(element,'position');if(!pos||pos=='static') |
|
141 {element.style.position='relative';if(window.opera) |
|
142 {element.style.top=0;element.style.left=0;}}};Spry.Effect.isInvisible=function(element) |
|
143 {var propDisplay=Spry.Effect.getStyleProp(element,'display');if(propDisplay&&propDisplay.toLowerCase()=='none') |
|
144 return true;var propVisible=Spry.Effect.getStyleProp(element,'visibility');if(propVisible&&propVisible.toLowerCase()=='hidden') |
|
145 return true;return false;};Spry.Effect.enforceVisible=function(element) |
|
146 {var propDisplay=Spry.Effect.getStyleProp(element,'display');if(propDisplay&&propDisplay.toLowerCase()=='none') |
|
147 Spry.Effect.setStyleProp(element,'display','block');var propVisible=Spry.Effect.getStyleProp(element,'visibility');if(propVisible&&propVisible.toLowerCase()=='hidden') |
|
148 Spry.Effect.setStyleProp(element,'visibility','visible');};Spry.Effect.makeClipping=function(element) |
|
149 {var overflow=Spry.Effect.getStyleProp(element,'overflow');if(!overflow||(overflow.toLowerCase()!='hidden'&&overflow.toLowerCase()!='scroll')) |
|
150 {var heightCache=0;var needsCache=/MSIE 7.0/.test(navigator.userAgent)&&/Windows NT/.test(navigator.userAgent);if(needsCache) |
|
151 heightCache=Spry.Effect.getDimensionsRegardlessOfDisplayState(element).height;Spry.Effect.setStyleProp(element,'overflow','hidden');if(needsCache) |
|
152 Spry.Effect.setStyleProp(element,'height',heightCache+'px');}};Spry.Effect.cleanWhitespace=function(element) |
|
153 {var childCountInit=element.childNodes.length;for(var i=childCountInit-1;i>=0;i--){var node=element.childNodes[i];if(node.nodeType==3&&!/\S/.test(node.nodeValue)) |
|
154 try |
|
155 {element.removeChild(node);} |
|
156 catch(e){Spry.Effect.Utils.showError('Spry.Effect.cleanWhitespace: '+e);}}};Spry.Effect.getComputedStyle=function(element) |
|
157 {return/MSIE/.test(navigator.userAgent)?element.currentStyle:document.defaultView.getComputedStyle(element,null);};Spry.Effect.getDimensions=function(element) |
|
158 {var dimensions=new Spry.Effect.Utils.Rectangle;var computedStyle=null;if(element.style.width&&/px/i.test(element.style.width)) |
|
159 dimensions.width=parseInt(element.style.width,10);else |
|
160 {computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.width&&/px/i.test(computedStyle.width);if(tryComputedStyle) |
|
161 dimensions.width=parseInt(computedStyle.width,10);if(!tryComputedStyle||dimensions.width==0) |
|
162 dimensions.width=element.offsetWidth;} |
|
163 if(element.style.height&&/px/i.test(element.style.height)) |
|
164 dimensions.height=parseInt(element.style.height,10);else |
|
165 {if(!computedStyle) |
|
166 computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.height&&/px/i.test(computedStyle.height);if(tryComputedStyle) |
|
167 dimensions.height=parseInt(computedStyle.height,10);if(!tryComputedStyle||dimensions.height==0) |
|
168 dimensions.height=element.offsetHeight;} |
|
169 return dimensions;};Spry.Effect.getDimensionsRegardlessOfDisplayState=function(element,displayElement) |
|
170 {var refElement=displayElement?displayElement:element;var displayOrig=Spry.Effect.getStyleProp(refElement,'display');var visibilityOrig=Spry.Effect.getStyleProp(refElement,'visibility');if(displayOrig=='none') |
|
171 {Spry.Effect.setStyleProp(refElement,'visibility','hidden');Spry.Effect.setStyleProp(refElement,'display','block');if(window.opera) |
|
172 refElement.focus();} |
|
173 var dimensions=Spry.Effect.getDimensions(element);if(displayOrig=='none') |
|
174 {Spry.Effect.setStyleProp(refElement,'display','none');Spry.Effect.setStyleProp(refElement,'visibility',visibilityOrig);} |
|
175 return dimensions;};Spry.Effect.getOpacity=function(element) |
|
176 {var o=Spry.Effect.getStyleProp(element,"opacity");if(typeof o=='undefined'||o==null) |
|
177 o=1.0;return o;};Spry.Effect.getBgColor=function(ele) |
|
178 {return Spry.Effect.getStyleProp(ele,"background-color");};Spry.Effect.intPropStyle=function(e,prop){var i=parseInt(Spry.Effect.getStyleProp(e,prop),10);if(isNaN(i)) |
|
179 return 0;return i;};Spry.Effect.getPosition=function(element) |
|
180 {var position=new Spry.Effect.Utils.Position;var computedStyle=null;if(element.style.left&&/px/i.test(element.style.left)) |
|
181 position.x=parseInt(element.style.left,10);else |
|
182 {computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.left&&/px/i.test(computedStyle.left);if(tryComputedStyle) |
|
183 position.x=parseInt(computedStyle.left,10);if(!tryComputedStyle||position.x==0) |
|
184 position.x=element.offsetLeft;} |
|
185 if(element.style.top&&/px/i.test(element.style.top)) |
|
186 position.y=parseInt(element.style.top,10);else |
|
187 {if(!computedStyle) |
|
188 computedStyle=Spry.Effect.getComputedStyle(element);var tryComputedStyle=computedStyle&&computedStyle.top&&/px/i.test(computedStyle.top);if(tryComputedStyle) |
|
189 position.y=parseInt(computedStyle.top,10);if(!tryComputedStyle||position.y==0) |
|
190 position.y=element.offsetTop;} |
|
191 return position;};Spry.Effect.getOffsetPosition=Spry.Effect.getPosition;Spry.Effect.Animator=function(options) |
|
192 {Spry.Utils.Notifier.call(this);this.name='Animator';this.element=null;this.startMilliseconds=0;this.repeat='none';this.isRunning=false;this.timer=null;this.cancelRemaining=0;if(!options) |
|
193 var options={};if(options.toggle) |
|
194 this.direction=false;else |
|
195 this.direction=Spry.forwards;var self=this;if(options.setup!=null) |
|
196 this.addObserver({onPreEffect:function(){try{self.options.setup(self.element,self);}catch(e){Spry.Effect.Utils.showError('Spry.Effect.Animator.prototype.start: setup callback: '+e);}}});if(options.finish!=null) |
|
197 this.addObserver({onPostEffect:function(){try{self.options.finish(self.element,self);}catch(e){Spry.Effect.Utils.showError('Spry.Effect.Animator.prototype.stop: finish callback: '+e);}}});this.options={duration:1000,toggle:false,transition:Spry.linearTransition,interval:16};this.setOptions(options);if(options.transition) |
|
198 this.setTransition(options.transition);if(options.fps) |
|
199 this.setFps(options.fps);};Spry.Effect.Animator.prototype=new Spry.Utils.Notifier();Spry.Effect.Animator.prototype.constructor=Spry.Utils.Animator;Spry.Effect.Animator.prototype.notStaticAnimator=true;Spry.Effect.Animator.prototype.setOptions=function(options) |
|
200 {if(!options) |
|
201 return;for(var prop in options) |
|
202 this.options[prop]=options[prop];};Spry.Effect.Animator.prototype.setTransition=function(transition){if(typeof transition=='number'||transition=="1"||transition=="2") |
|
203 switch(parseInt(transition,10)) |
|
204 {case 1:transition=Spry.linearTransition;break;case 2:transition=Spry.sinusoidalTransition;break;default:Spry.Effect.Utils.showError('unknown transition');} |
|
205 else if(typeof transition=='string') |
|
206 {if(typeof window[transition]=='function') |
|
207 transition=window[transition];else if(typeof Spry[transition]=='function') |
|
208 transition=Spry[transition];else |
|
209 Spry.Effect.Utils.showError('unknown transition');} |
|
210 this.options.transition=transition;if(typeof this.effectsArray!='undefined'){var l=this.effectsArray.length;for(var i=0;i<l;i++) |
|
211 this.effectsArray[i].effect.setTransition(transition);}};Spry.Effect.Animator.prototype.setDuration=function(duration){this.options.duration=duration;if(typeof this.effectsArray!='undefined') |
|
212 {var l=this.effectsArray.length;for(var i=0;i<l;i++) |
|
213 {this.effectsArray[i].effect.setDuration(duration);}}};Spry.Effect.Animator.prototype.setFps=function(fps){this.options.interval=parseInt(1000/fps,10);this.options.fps=fps;if(typeof this.effectsArray!='undefined') |
|
214 {var l=this.effectsArray.length;for(var i=0;i<l;i++) |
|
215 {this.effectsArray[i].effect.setFps(fps);}}};Spry.Effect.Animator.prototype.start=function(withoutTimer) |
|
216 {if(!this.element) |
|
217 return;if(arguments.length==0) |
|
218 withoutTimer=false;if(this.isRunning) |
|
219 this.cancel();this.prepareStart();var currDate=new Date();this.startMilliseconds=currDate.getTime();if(this.element.id) |
|
220 this.element=document.getElementById(this.element.id);if(this.cancelRemaining!=0&&this.options.toggle) |
|
221 {if(this.cancelRemaining<1&&typeof this.options.transition=='function') |
|
222 {var startTime=0;var stopTime=this.options.duration;var start=0;var stop=1;var emergency=0;this.cancelRemaining=Math.round(this.cancelRemaining*1000)/1000;var found=false;var middle=0;while(!found) |
|
223 {if(emergency++>this.options.duration)break;var half=startTime+((stopTime-startTime)/2);middle=Math.round(this.options.transition(half,1,-1,this.options.duration)*1000)/1000;if(middle==this.cancelRemaining) |
|
224 {this.startMilliseconds-=half;found=true;} |
|
225 if(middle<this.cancelRemaining) |
|
226 {stopTime=half;stop=middle;} |
|
227 else |
|
228 {startTime=half;start=middle;}}} |
|
229 this.cancelRemaining=0;} |
|
230 this.notifyObservers('onPreEffect',this);if(withoutTimer==false) |
|
231 {var self=this;this.timer=setInterval(function(){self.drawEffect();},this.options.interval);} |
|
232 this.isRunning=true;};Spry.Effect.Animator.prototype.stopFlagReset=function() |
|
233 {if(this.timer) |
|
234 {clearInterval(this.timer);this.timer=null;} |
|
235 this.startMilliseconds=0;};Spry.Effect.Animator.prototype.stop=function() |
|
236 {this.stopFlagReset();this.notifyObservers('onPostEffect',this);this.isRunning=false;};Spry.Effect.Animator.prototype.cancel=function() |
|
237 {var elapsed=this.getElapsedMilliseconds();if(this.startMilliseconds>0&&elapsed<this.options.duration) |
|
238 this.cancelRemaining=this.options.transition(elapsed,0,1,this.options.duration);this.stopFlagReset();this.notifyObservers('onCancel',this);this.isRunning=false;};Spry.Effect.Animator.prototype.drawEffect=function() |
|
239 {var isRunning=true;this.notifyObservers('onStep',this);var timeElapsed=this.getElapsedMilliseconds();if(typeof this.options.transition!='function'){Spry.Effect.Utils.showError('unknown transition');return;} |
|
240 this.animate();if(timeElapsed>this.options.duration) |
|
241 {isRunning=false;this.stop();} |
|
242 return isRunning;};Spry.Effect.Animator.prototype.getElapsedMilliseconds=function() |
|
243 {if(this.startMilliseconds>0) |
|
244 {var currDate=new Date();return(currDate.getTime()-this.startMilliseconds);} |
|
245 return 0;};Spry.Effect.Animator.prototype.doToggle=function() |
|
246 {if(!this.direction) |
|
247 {this.direction=Spry.forwards;return;} |
|
248 if(this.options.toggle==true) |
|
249 {if(this.direction==Spry.forwards) |
|
250 {this.direction=Spry.backwards;this.notifyObservers('onToggle',this);} |
|
251 else if(this.direction==Spry.backwards) |
|
252 {this.direction=Spry.forwards;}}};Spry.Effect.Animator.prototype.prepareStart=function() |
|
253 {if(this.options&&this.options.toggle) |
|
254 this.doToggle();};Spry.Effect.Animator.prototype.animate=function(){};Spry.Effect.Animator.prototype.onStep=function(el) |
|
255 {if(el!=this) |
|
256 this.notifyObservers('onStep',this);};Spry.Effect.Move=function(element,fromPos,toPos,options) |
|
257 {this.dynamicFromPos=false;if(arguments.length==3) |
|
258 {options=toPos;toPos=fromPos;fromPos=Spry.Effect.getPosition(element);this.dynamicFromPos=true;} |
|
259 Spry.Effect.Animator.call(this,options);this.name='Move';this.element=Spry.Effect.getElement(element);if(!this.element) |
|
260 return;if(fromPos.units!=toPos.units) |
|
261 Spry.Effect.Utils.showError('Spry.Effect.Move: Conflicting units ('+fromPos.units+', '+toPos.units+')');this.units=fromPos.units;this.startX=Number(fromPos.x);this.stopX=Number(toPos.x);this.startY=Number(fromPos.y);this.stopY=Number(toPos.y);};Spry.Effect.Move.prototype=new Spry.Effect.Animator();Spry.Effect.Move.prototype.constructor=Spry.Effect.Move;Spry.Effect.Move.prototype.animate=function() |
|
262 {var left=0;var top=0;var floor=Math.floor;var elapsed=this.getElapsedMilliseconds();if(this.direction==Spry.forwards) |
|
263 {left=floor(this.options.transition(elapsed,this.startX,this.stopX-this.startX,this.options.duration));top=floor(this.options.transition(elapsed,this.startY,this.stopY-this.startY,this.options.duration));} |
|
264 else if(this.direction==Spry.backwards) |
|
265 {left=floor(this.options.transition(elapsed,this.stopX,this.startX-this.stopX,this.options.duration));top=floor(this.options.transition(elapsed,this.stopY,this.startY-this.stopY,this.options.duration));} |
|
266 this.element.style.left=left+this.units;this.element.style.top=top+this.units;};Spry.Effect.Move.prototype.prepareStart=function() |
|
267 {if(this.options&&this.options.toggle) |
|
268 this.doToggle();if(this.dynamicFromPos==true) |
|
269 {var fromPos=Spry.Effect.getPosition(this.element);this.startX=fromPos.x;this.startY=fromPos.y;this.rangeMoveX=this.startX-this.stopX;this.rangeMoveY=this.startY-this.stopY;}};Spry.Effect.Size=function(element,fromRect,toRect,options) |
|
270 {this.dynamicFromRect=false;if(arguments.length==3) |
|
271 {options=toRect;toRect=fromRect;fromRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);this.dynamicFromRect=true;} |
|
272 Spry.Effect.Animator.call(this,options);this.name='Size';this.element=Spry.Effect.getElement(element);if(!this.element) |
|
273 return;element=this.element;if(fromRect.units!=toRect.units) |
|
274 {Spry.Effect.Utils.showError('Spry.Effect.Size: Conflicting units ('+fromRect.units+', '+toRect.units+')');return false;} |
|
275 this.units=fromRect.units;var originalRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);this.originalWidth=originalRect.width;this.originalHeight=originalRect.height;this.startWidth=fromRect.width;this.startHeight=fromRect.height;this.stopWidth=toRect.width;this.stopHeight=toRect.height;this.childImages=new Array();if(this.options.useCSSBox){Spry.Effect.makePositioned(this.element);var intProp=Spry.Effect.intPropStyle;this.startFromBorder_top=intProp(element,'border-top-width');this.startFromBorder_bottom=intProp(element,'border-bottom-width');this.startFromBorder_left=intProp(element,'border-left-width');this.startFromBorder_right=intProp(element,'border-right-width');this.startFromPadding_top=intProp(element,'padding-top');this.startFromPadding_bottom=intProp(element,'padding-bottom');this.startFromPadding_left=intProp(element,'padding-left');this.startFromPadding_right=intProp(element,'padding-right');this.startFromMargin_top=intProp(element,'margin-top');this.startFromMargin_bottom=intProp(element,'margin-bottom');this.startFromMargin_right=intProp(element,'margin-right');this.startFromMargin_left=intProp(element,'margin-left');this.startLeft=intProp(element,'left');this.startTop=intProp(element,'top');} |
|
276 if(this.options.scaleContent) |
|
277 Spry.Effect.Utils.fetchChildImages(element,this.childImages);this.fontFactor=1.0;var fontSize=Spry.Effect.getStyleProp(this.element,'font-size');if(fontSize&&/em\s*$/.test(fontSize)) |
|
278 this.fontFactor=parseFloat(fontSize);var isPercent=Spry.Effect.Utils.isPercentValue;if(isPercent(this.startWidth)) |
|
279 {var startWidthPercent=Spry.Effect.Utils.getPercentValue(this.startWidth);this.startWidth=originalRect.width*(startWidthPercent/100);} |
|
280 if(isPercent(this.startHeight)) |
|
281 {var startHeightPercent=Spry.Effect.Utils.getPercentValue(this.startHeight);this.startHeight=originalRect.height*(startHeightPercent/100);} |
|
282 if(isPercent(this.stopWidth)) |
|
283 {var stopWidthPercent=Spry.Effect.Utils.getPercentValue(this.stopWidth);this.stopWidth=originalRect.width*(stopWidthPercent/100);} |
|
284 if(isPercent(this.stopHeight)) |
|
285 {var stopHeightPercent=Spry.Effect.Utils.getPercentValue(this.stopHeight);this.stopHeight=originalRect.height*(stopHeightPercent/100);} |
|
286 this.enforceVisible=Spry.Effect.isInvisible(this.element);};Spry.Effect.Size.prototype=new Spry.Effect.Animator();Spry.Effect.Size.prototype.constructor=Spry.Effect.Size;Spry.Effect.Size.prototype.animate=function() |
|
287 {var width=0;var height=0;var fontSize=0;var direction=0;var floor=Math.floor;var elapsed=this.getElapsedMilliseconds();if(this.direction==Spry.forwards){width=floor(this.options.transition(elapsed,this.startWidth,this.stopWidth-this.startWidth,this.options.duration));height=floor(this.options.transition(elapsed,this.startHeight,this.stopHeight-this.startHeight,this.options.duration));direction=1;}else if(this.direction==Spry.backwards){width=floor(this.options.transition(elapsed,this.stopWidth,this.startWidth-this.stopWidth,this.options.duration));height=floor(this.options.transition(elapsed,this.stopHeight,this.startHeight-this.stopHeight,this.options.duration));direction=-1;} |
|
288 var propFactor=width/this.originalWidth;fontSize=this.fontFactor*propFactor;var elStyle=this.element.style;if(width<0) |
|
289 width=0;if(height<0) |
|
290 height=0;elStyle.width=width+this.units;elStyle.height=height+this.units;if(typeof this.options.useCSSBox!='undefined'&&this.options.useCSSBox==true) |
|
291 {var intProp=Spry.Effect.intPropStyle;var origTop=intProp(this.element,'top');var origLeft=intProp(this.element,'left');var origMarginTop=intProp(this.element,'margin-top');var origMarginLeft=intProp(this.element,'margin-left');var widthFactor=propFactor;var heightFactor=height/this.originalHeight;var border_top=floor(this.startFromBorder_top*heightFactor);var border_bottom=floor(this.startFromBorder_bottom*heightFactor);var border_left=floor(this.startFromBorder_left*widthFactor);var border_right=floor(this.startFromBorder_right*widthFactor);var padding_top=floor(this.startFromPadding_top*heightFactor);var padding_bottom=floor(this.startFromPadding_bottom*heightFactor);var padding_left=floor(this.startFromPadding_left*widthFactor);var padding_right=floor(this.startFromPadding_right*widthFactor);var margin_top=floor(this.startFromMargin_top*heightFactor);var margin_bottom=floor(this.startFromMargin_bottom*heightFactor);var margin_right=floor(this.startFromMargin_right*widthFactor);var margin_left=floor(this.startFromMargin_left*widthFactor);elStyle.borderTopWidth=border_top+this.units;elStyle.borderBottomWidth=border_bottom+this.units;elStyle.borderLeftWidth=border_left+this.units;elStyle.borderRightWidth=border_right+this.units;elStyle.paddingTop=padding_top+this.units;elStyle.paddingBottom=padding_bottom+this.units;elStyle.paddingLeft=padding_left+this.units;elStyle.paddingRight=padding_right+this.units;elStyle.marginTop=margin_top+this.units;elStyle.marginBottom=margin_bottom+this.units;elStyle.marginLeft=margin_left+this.units;elStyle.marginRight=margin_right+this.units;elStyle.left=floor(origLeft+origMarginLeft-margin_left)+this.units;elStyle.top=floor(origTop+origMarginTop-margin_top)+this.units;} |
|
292 if(this.options.scaleContent) |
|
293 {for(var i=0;i<this.childImages.length;i++) |
|
294 {this.childImages[i][0].style.width=propFactor*this.childImages[i][1]+this.units;this.childImages[i][0].style.height=propFactor*this.childImages[i][2]+this.units;} |
|
295 this.element.style.fontSize=fontSize+'em';} |
|
296 if(this.enforceVisible) |
|
297 {Spry.Effect.enforceVisible(this.element);this.enforceVisible=false;}};Spry.Effect.Size.prototype.prepareStart=function() |
|
298 {if(this.options&&this.options.toggle) |
|
299 this.doToggle();if(this.dynamicFromRect==true) |
|
300 {var fromRect=Spry.Effect.getDimensions(this.element);this.startWidth=fromRect.width;this.startHeight=fromRect.height;this.widthRange=this.startWidth-this.stopWidth;this.heightRange=this.startHeight-this.stopHeight;}};Spry.Effect.Opacity=function(element,startOpacity,stopOpacity,options) |
|
301 {this.dynamicStartOpacity=false;if(arguments.length==3) |
|
302 {options=stopOpacity;stopOpacity=startOpacity;startOpacity=Spry.Effect.getOpacity(element);this.dynamicStartOpacity=true;} |
|
303 Spry.Effect.Animator.call(this,options);this.name='Opacity';this.element=Spry.Effect.getElement(element);if(!this.element) |
|
304 return;if(/MSIE/.test(navigator.userAgent)&&(!this.element.hasLayout)) |
|
305 Spry.Effect.setStyleProp(this.element,'zoom','1');this.startOpacity=startOpacity;this.stopOpacity=stopOpacity;this.enforceVisible=Spry.Effect.isInvisible(this.element);};Spry.Effect.Opacity.prototype=new Spry.Effect.Animator();Spry.Effect.Opacity.prototype.constructor=Spry.Effect.Opacity;Spry.Effect.Opacity.prototype.animate=function() |
|
306 {var opacity=0;var elapsed=this.getElapsedMilliseconds();if(this.direction==Spry.forwards) |
|
307 opacity=this.options.transition(elapsed,this.startOpacity,this.stopOpacity-this.startOpacity,this.options.duration);else if(this.direction==Spry.backwards) |
|
308 opacity=this.options.transition(elapsed,this.stopOpacity,this.startOpacity-this.stopOpacity,this.options.duration);if(opacity<0) |
|
309 opacity=0;if(/MSIE/.test(navigator.userAgent)) |
|
310 {var tmpval=Spry.Effect.getStyleProp(this.element,'filter');if(tmpval){tmpval=tmpval.replace(/alpha\(opacity=[0-9]{1,3}\)/g,'');} |
|
311 this.element.style.filter=tmpval+"alpha(opacity="+Math.floor(opacity*100)+")";} |
|
312 else |
|
313 this.element.style.opacity=opacity;if(this.enforceVisible) |
|
314 {Spry.Effect.enforceVisible(this.element);this.enforceVisible=false;}};Spry.Effect.Opacity.prototype.prepareStart=function() |
|
315 {if(this.options&&this.options.toggle) |
|
316 this.doToggle();if(this.dynamicStartOpacity==true) |
|
317 {this.startOpacity=Spry.Effect.getOpacity(this.element);this.opacityRange=this.startOpacity-this.stopOpacity;}};Spry.Effect.Color=function(element,startColor,stopColor,options) |
|
318 {this.dynamicStartColor=false;if(arguments.length==3) |
|
319 {options=stopColor;stopColor=startColor;startColor=Spry.Effect.getBgColor(element);this.dynamicStartColor=true;} |
|
320 Spry.Effect.Animator.call(this,options);this.name='Color';this.element=Spry.Effect.getElement(element);if(!this.element) |
|
321 return;this.startColor=startColor;this.stopColor=stopColor;this.startRedColor=Spry.Effect.Utils.hexToInt(startColor.substr(1,2));this.startGreenColor=Spry.Effect.Utils.hexToInt(startColor.substr(3,2));this.startBlueColor=Spry.Effect.Utils.hexToInt(startColor.substr(5,2));this.stopRedColor=Spry.Effect.Utils.hexToInt(stopColor.substr(1,2));this.stopGreenColor=Spry.Effect.Utils.hexToInt(stopColor.substr(3,2));this.stopBlueColor=Spry.Effect.Utils.hexToInt(stopColor.substr(5,2));};Spry.Effect.Color.prototype=new Spry.Effect.Animator();Spry.Effect.Color.prototype.constructor=Spry.Effect.Color;Spry.Effect.Color.prototype.animate=function() |
|
322 {var redColor=0;var greenColor=0;var blueColor=0;var floor=Math.floor;var elapsed=this.getElapsedMilliseconds();if(this.direction==Spry.forwards) |
|
323 {redColor=floor(this.options.transition(elapsed,this.startRedColor,this.stopRedColor-this.startRedColor,this.options.duration));greenColor=floor(this.options.transition(elapsed,this.startGreenColor,this.stopGreenColor-this.startGreenColor,this.options.duration));blueColor=floor(this.options.transition(elapsed,this.startBlueColor,this.stopBlueColor-this.startBlueColor,this.options.duration));} |
|
324 else if(this.direction==Spry.backwards) |
|
325 {redColor=floor(this.options.transition(elapsed,this.stopRedColor,this.startRedColor-this.stopRedColor,this.options.duration));greenColor=floor(this.options.transition(elapsed,this.stopGreenColor,this.startGreenColor-this.stopGreenColor,this.options.duration));blueColor=floor(this.options.transition(elapsed,this.stopBlueColor,this.startBlueColor-this.stopBlueColor,this.options.duration));} |
|
326 this.element.style.backgroundColor=Spry.Effect.Utils.rgb(redColor,greenColor,blueColor);};Spry.Effect.Color.prototype.prepareStart=function() |
|
327 {if(this.options&&this.options.toggle) |
|
328 this.doToggle();if(this.dynamicStartColor==true) |
|
329 {this.startColor=Spry.Effect.getBgColor(element);this.startRedColor=Spry.Effect.Utils.hexToInt(startColor.substr(1,2));this.startGreenColor=Spry.Effect.Utils.hexToInt(startColor.substr(3,2));this.startBlueColor=Spry.Effect.Utils.hexToInt(startColor.substr(5,2));this.redColorRange=this.startRedColor-this.stopRedColor;this.greenColorRange=this.startGreenColor-this.stopGreenColor;this.blueColorRange=this.startBlueColor-this.stopBlueColor;}};Spry.Effect.Cluster=function(options) |
|
330 {Spry.Effect.Animator.call(this,options);this.name='Cluster';this.effectsArray=new Array();this.currIdx=-1;var _ClusteredEffect=function(effect,kind) |
|
331 {this.effect=effect;this.kind=kind;this.isRunning=false;};this.ClusteredEffect=_ClusteredEffect;};Spry.Effect.Cluster.prototype=new Spry.Effect.Animator();Spry.Effect.Cluster.prototype.constructor=Spry.Effect.Cluster;Spry.Effect.Cluster.prototype.setInterval=function(interval){var l=this.effectsArray.length;this.options.interval=interval;for(var i=0;i<l;i++) |
|
332 {this.effectsArray[i].effect.setInterval(interval);}};Spry.Effect.Cluster.prototype.drawEffect=function() |
|
333 {var isRunning=true;var allEffectsDidRun=false;var baseEffectIsStillRunning=false;var evalNextEffectsRunning=false;if((this.currIdx==-1&&this.direction==Spry.forwards)||(this.currIdx==this.effectsArray.length&&this.direction==Spry.backwards)) |
|
334 this.initNextEffectsRunning();var start=this.direction==Spry.forwards?0:this.effectsArray.length-1;var stop=this.direction==Spry.forwards?this.effectsArray.length:-1;var step=this.direction==Spry.forwards?1:-1;for(var i=start;i!=stop;i+=step) |
|
335 {if(this.effectsArray[i].isRunning==true) |
|
336 {baseEffectIsStillRunning=this.effectsArray[i].effect.drawEffect();if(baseEffectIsStillRunning==false&&i==this.currIdx) |
|
337 {this.effectsArray[i].isRunning=false;evalNextEffectsRunning=true;}}} |
|
338 if(evalNextEffectsRunning==true) |
|
339 allEffectsDidRun=this.initNextEffectsRunning();if(allEffectsDidRun==true){this.stop();isRunning=false;for(var i=0;i<this.effectsArray.length;i++) |
|
340 this.effectsArray[i].isRunning=false;this.currIdx=this.direction==Spry.forwards?this.effectsArray.length:-1;} |
|
341 return isRunning;};Spry.Effect.Cluster.prototype.initNextEffectsRunning=function() |
|
342 {var allEffectsDidRun=false;var step=this.direction==Spry.forwards?1:-1;var stop=this.direction==Spry.forwards?this.effectsArray.length:-1;this.currIdx+=step;if((this.currIdx>(this.effectsArray.length-1)&&this.direction==Spry.forwards)||(this.currIdx<0&&this.direction==Spry.backwards)) |
|
343 allEffectsDidRun=true;else |
|
344 for(var i=this.currIdx;i!=stop;i+=step) |
|
345 {if((i>this.currIdx&&this.direction==Spry.forwards||i<this.currIdx&&this.direction==Spry.backwards)&&this.effectsArray[i].kind=="queue") |
|
346 break;this.effectsArray[i].effect.start(true);this.effectsArray[i].isRunning=true;this.currIdx=i;} |
|
347 return allEffectsDidRun;};Spry.Effect.Cluster.prototype.toggleCluster=function() |
|
348 {if(!this.direction) |
|
349 {this.direction=Spry.forwards;return;} |
|
350 if(this.options.toggle==true) |
|
351 {if(this.direction==Spry.forwards) |
|
352 {this.direction=Spry.backwards;this.notifyObservers('onToggle',this);this.currIdx=this.effectsArray.length;} |
|
353 else if(this.direction==Spry.backwards) |
|
354 {this.direction=Spry.forwards;this.currIdx=-1;}} |
|
355 else |
|
356 {if(this.direction==Spry.forwards) |
|
357 this.currIdx=-1;else if(this.direction==Spry.backwards) |
|
358 this.currIdx=this.effectsArray.length;}};Spry.Effect.Cluster.prototype.doToggle=function() |
|
359 {this.toggleCluster();for(var i=0;i<this.effectsArray.length;i++) |
|
360 {if(this.effectsArray[i].effect.options&&(this.effectsArray[i].effect.options.toggle!=null)) |
|
361 if(this.effectsArray[i].effect.options.toggle==true) |
|
362 this.effectsArray[i].effect.doToggle();}};Spry.Effect.Cluster.prototype.cancel=function() |
|
363 {for(var i=0;i<this.effectsArray.length;i++) |
|
364 if(this.effectsArray[i].effect.isRunning) |
|
365 this.effectsArray[i].effect.cancel();var elapsed=this.getElapsedMilliseconds();if(this.startMilliseconds>0&&elapsed<this.options.duration) |
|
366 this.cancelRemaining=this.options.transition(elapsed,0,1,this.options.duration);this.stopFlagReset();this.notifyObservers('onCancel',this);this.isRunning=false;};Spry.Effect.Cluster.prototype.addNextEffect=function(effect) |
|
367 {effect.addObserver(this);this.effectsArray[this.effectsArray.length]=new this.ClusteredEffect(effect,"queue");if(this.effectsArray.length==1) |
|
368 {this.element=effect.element;}};Spry.Effect.Cluster.prototype.addParallelEffect=function(effect) |
|
369 {if(this.effectsArray.length==0||this.effectsArray[this.effectsArray.length-1].kind!='parallel') |
|
370 effect.addObserver(this);this.effectsArray[this.effectsArray.length]=new this.ClusteredEffect(effect,"parallel");if(this.effectsArray.length==1) |
|
371 {this.element=effect.element;}};Spry.Effect.Cluster.prototype.prepareStart=function() |
|
372 {this.toggleCluster();};Spry.Effect.Fade=function(element,options) |
|
373 {if(!this.notStaticAnimator) |
|
374 return Spry.Effect.Utils.showInitError('Fade');Spry.Effect.Cluster.call(this,options);this.name='Fade';var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
|
375 return;var durationInMilliseconds=1000;var fromOpacity=0.0;var toOpacity=100.0;var doToggle=false;var transition=Spry.fifthTransition;var fps=60;var originalOpacity=0;if(/MSIE/.test(navigator.userAgent)) |
|
376 originalOpacity=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(this.element,'filter').replace(/alpha\(opacity=([0-9]{1,3})\)/g,'$1'),10);else |
|
377 originalOpacity=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(this.element,'opacity')*100,10);if(isNaN(originalOpacity)) |
|
378 originalOpacity=100;if(options) |
|
379 {if(options.duration!=null)durationInMilliseconds=options.duration;if(options.from!=null){if(Spry.Effect.Utils.isPercentValue(options.from)) |
|
380 fromOpacity=Spry.Effect.Utils.getPercentValue(options.from)*originalOpacity/100;else |
|
381 fromOpacity=options.from;} |
|
382 if(options.to!=null) |
|
383 {if(Spry.Effect.Utils.isPercentValue(options.to)) |
|
384 toOpacity=Spry.Effect.Utils.getPercentValue(options.to)*originalOpacity/100;else |
|
385 toOpacity=options.to;} |
|
386 if(options.toggle!=null)doToggle=options.toggle;if(options.transition!=null)transition=options.transition;if(options.fps!=null)fps=options.fps;else this.options.transition=transition;} |
|
387 fromOpacity=fromOpacity/100.0;toOpacity=toOpacity/100.0;options={duration:durationInMilliseconds,toggle:doToggle,transition:transition,from:fromOpacity,to:toOpacity,fps:fps};var fadeEffect=new Spry.Effect.Opacity(element,fromOpacity,toOpacity,options);this.addNextEffect(fadeEffect);};Spry.Effect.Fade.prototype=new Spry.Effect.Cluster();Spry.Effect.Fade.prototype.constructor=Spry.Effect.Fade;Spry.Effect.Blind=function(element,options) |
|
388 {if(!this.notStaticAnimator) |
|
389 return Spry.Effect.Utils.showInitError('Blind');Spry.Effect.Cluster.call(this,options);this.name='Blind';var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
|
390 return;var durationInMilliseconds=1000;var doToggle=false;var kindOfTransition=Spry.circleTransition;var fps=60;var doScaleContent=false;Spry.Effect.makeClipping(element);var originalRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);var fromHeightPx=originalRect.height;var toHeightPx=0;var optionFrom=options?options.from:originalRect.height;var optionTo=options?options.to:0;var fullCSSBox=false;if(options) |
|
391 {if(options.duration!=null)durationInMilliseconds=options.duration;if(options.from!=null) |
|
392 {if(Spry.Effect.Utils.isPercentValue(options.from)) |
|
393 fromHeightPx=Spry.Effect.Utils.getPercentValue(options.from)*originalRect.height/100;else |
|
394 fromHeightPx=Spry.Effect.Utils.getPixelValue(options.from);} |
|
395 if(options.to!=null) |
|
396 {if(Spry.Effect.Utils.isPercentValue(options.to)) |
|
397 toHeightPx=Spry.Effect.Utils.getPercentValue(options.to)*originalRect.height/100;else |
|
398 toHeightPx=Spry.Effect.Utils.getPixelValue(options.to);} |
|
399 if(options.toggle!=null)doToggle=options.toggle;if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;if(options.useCSSBox!=null)fullCSSBox=options.useCSSBox;} |
|
400 var fromRect=new Spry.Effect.Utils.Rectangle;fromRect.width=originalRect.width;fromRect.height=fromHeightPx;var toRect=new Spry.Effect.Utils.Rectangle;toRect.width=originalRect.width;toRect.height=toHeightPx;options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,scaleContent:doScaleContent,useCSSBox:fullCSSBox,from:optionFrom,to:optionTo,fps:fps};var blindEffect=new Spry.Effect.Size(element,fromRect,toRect,options);this.addNextEffect(blindEffect);};Spry.Effect.Blind.prototype=new Spry.Effect.Cluster();Spry.Effect.Blind.prototype.constructor=Spry.Effect.Blind;Spry.Effect.Highlight=function(element,options) |
|
401 {if(!this.notStaticAnimator) |
|
402 return Spry.Effect.Utils.showInitError('Highlight');Spry.Effect.Cluster.call(this,options);this.name='Highlight';var durationInMilliseconds=1000;var toColor="#ffffff";var doToggle=false;var kindOfTransition=Spry.sinusoidalTransition;var fps=60;var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
|
403 return;var fromColor=Spry.Effect.getBgColor(element);if(fromColor=="transparent")fromColor="#ffff99";if(options) |
|
404 {if(options.duration!=null)durationInMilliseconds=options.duration;if(options.from!=null)fromColor=options.from;if(options.to!=null)toColor=options.to;if(options.toggle!=null)doToggle=options.toggle;if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;} |
|
405 if(fromColor.indexOf('rgb')!=-1) |
|
406 var fromColor=Spry.Effect.Utils.rgb(parseInt(fromColor.substring(fromColor.indexOf('(')+1,fromColor.indexOf(',')),10),parseInt(fromColor.substring(fromColor.indexOf(',')+1,fromColor.lastIndexOf(',')),10),parseInt(fromColor.substring(fromColor.lastIndexOf(',')+1,fromColor.indexOf(')')),10));if(toColor.indexOf('rgb')!=-1) |
|
407 var toColor=Spry.Effect.Utils.rgb(parseInt(toColor.substring(toColor.indexOf('(')+1,toColor.indexOf(',')),10),parseInt(toColor.substring(toColor.indexOf(',')+1,toColor.lastIndexOf(',')),10),parseInt(toColor.substring(toColor.lastIndexOf(',')+1,toColor.indexOf(')')),10));var fromColor=Spry.Effect.Utils.longColorVersion(fromColor);var toColor=Spry.Effect.Utils.longColorVersion(toColor);this.restoreBackgroundImage=Spry.Effect.getStyleProp(element,'background-image');options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,fps:fps};var highlightEffect=new Spry.Effect.Color(element,fromColor,toColor,options);this.addNextEffect(highlightEffect);this.addObserver({onPreEffect:function(effect){Spry.Effect.setStyleProp(effect.element,'background-image','none');},onPostEffect:function(effect){Spry.Effect.setStyleProp(effect.element,'background-image',effect.restoreBackgroundImage);if(effect.direction==Spry.forwards&&effect.options.restoreColor) |
|
408 Spry.Effect.setStyleProp(element,'background-color',effect.options.restoreColor);}});};Spry.Effect.Highlight.prototype=new Spry.Effect.Cluster();Spry.Effect.Highlight.prototype.constructor=Spry.Effect.Highlight;Spry.Effect.Slide=function(element,options) |
|
409 {if(!this.notStaticAnimator) |
|
410 return Spry.Effect.Utils.showInitError('Slide');Spry.Effect.Cluster.call(this,options);this.name='Slide';var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
|
411 return;var durationInMilliseconds=1000;var doToggle=false;var kindOfTransition=Spry.sinusoidalTransition;var fps=60;var slideHorizontally=false;var firstChildElt=Spry.Effect.Utils.getFirstChildElement(element);var direction=-1;if(/MSIE 7.0/.test(navigator.userAgent)&&/Windows NT/.test(navigator.userAgent)) |
|
412 Spry.Effect.makePositioned(element);Spry.Effect.makeClipping(element);if(/MSIE 6.0/.test(navigator.userAgent)&&/Windows NT/.test(navigator.userAgent)) |
|
413 {var pos=Spry.Effect.getStyleProp(element,'position');if(pos&&(pos=='static'||pos=='fixed')) |
|
414 {Spry.Effect.setStyleProp(element,'position','relative');Spry.Effect.setStyleProp(element,'top','');Spry.Effect.setStyleProp(element,'left','');}} |
|
415 if(firstChildElt) |
|
416 {Spry.Effect.makePositioned(firstChildElt);Spry.Effect.makeClipping(firstChildElt);var childRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(firstChildElt,element);Spry.Effect.setStyleProp(firstChildElt,'width',childRect.width+'px');} |
|
417 var fromDim=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);var initDim=new Spry.Effect.Utils.Rectangle();var toDim=new Spry.Effect.Utils.Rectangle();initDim.width=toDim.width=fromDim.width;initDim.height=toDim.height=fromDim.height;if(!this.options.to){if(!options) |
|
418 options={};options.to='0%';} |
|
419 if(options&&options.horizontal!==null&&options.horizontal===true) |
|
420 slideHorizontally=true;if(options.duration!=null)durationInMilliseconds=options.duration;if(options.from!=null) |
|
421 {if(slideHorizontally) |
|
422 {if(Spry.Effect.Utils.isPercentValue(options.from)) |
|
423 fromDim.width=initDim.width*Spry.Effect.Utils.getPercentValue(options.from)/100;else |
|
424 fromDim.width=Spry.Effect.Utils.getPixelValue(options.from);} |
|
425 else |
|
426 {if(Spry.Effect.Utils.isPercentValue(options.from)) |
|
427 fromDim.height=initDim.height*Spry.Effect.Utils.getPercentValue(options.from)/100;else |
|
428 fromDim.height=Spry.Effect.Utils.getPixelValue(options.from);}} |
|
429 if(options.to!=null) |
|
430 {if(slideHorizontally) |
|
431 {if(Spry.Effect.Utils.isPercentValue(options.to)) |
|
432 toDim.width=initDim.width*Spry.Effect.Utils.getPercentValue(options.to)/100;else |
|
433 toDim.width=Spry.Effect.Utils.getPixelValue(options.to);} |
|
434 else |
|
435 {if(Spry.Effect.Utils.isPercentValue(options.to)) |
|
436 toDim.height=initDim.height*Spry.Effect.Utils.getPercentValue(options.to)/100;else |
|
437 toDim.height=Spry.Effect.Utils.getPixelValue(options.to);}} |
|
438 if(options.toggle!=null)doToggle=options.toggle;if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;options={duration:durationInMilliseconds,transition:kindOfTransition,scaleContent:false,toggle:doToggle,fps:fps};var size=new Spry.Effect.Size(element,fromDim,toDim,options);this.addParallelEffect(size);if((fromDim.width<toDim.width&&slideHorizontally)||(fromDim.height<toDim.height&&!slideHorizontally)) |
|
439 direction=1;var fromPos=new Spry.Effect.Utils.Position();var toPos=new Spry.Effect.Utils.Position();toPos.x=fromPos.x=Spry.Effect.intPropStyle(firstChildElt,'left');toPos.y=fromPos.y=Spry.Effect.intPropStyle(firstChildElt,'top');toPos.units=fromPos.units;if(slideHorizontally) |
|
440 toPos.x=parseInt(fromPos.x+direction*(fromDim.width-toDim.width),10);else |
|
441 toPos.y=parseInt(fromPos.y+direction*(fromDim.height-toDim.height),10);if(direction==1){var tmp=fromPos;var fromPos=toPos;var toPos=tmp;} |
|
442 options={duration:durationInMilliseconds,transition:kindOfTransition,toggle:doToggle,from:fromPos,to:toPos,fps:fps};var move=new Spry.Effect.Move(firstChildElt,fromPos,toPos,options);this.addParallelEffect(move);};Spry.Effect.Slide.prototype=new Spry.Effect.Cluster();Spry.Effect.Slide.prototype.constructor=Spry.Effect.Slide;Spry.Effect.Grow=function(element,options) |
|
443 {if(!element) |
|
444 return;if(!this.notStaticAnimator) |
|
445 return Spry.Effect.Utils.showInitError('Grow');Spry.Effect.Cluster.call(this,options);this.name='Grow';var durationInMilliseconds=1000;var doToggle=false;var doScaleContent=true;var calcHeight=false;var growFromCenter=true;var fullCSSBox=false;var kindOfTransition=Spry.squareTransition;var fps=60;var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
|
446 return;Spry.Effect.makeClipping(element);var dimRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);var originalWidth=dimRect.width;var originalHeight=dimRect.height;var propFactor=(originalWidth==0)?1:originalHeight/originalWidth;var fromRect=new Spry.Effect.Utils.Rectangle;fromRect.width=0;fromRect.height=0;var toRect=new Spry.Effect.Utils.Rectangle;toRect.width=originalWidth;toRect.height=originalHeight;var optionFrom=options?options.from:dimRect.width;var optionTo=options?options.to:0;var pixelValue=Spry.Effect.Utils.getPixelValue;if(options) |
|
447 {if(options.growCenter!=null)growFromCenter=options.growCenter;if(options.duration!=null)durationInMilliseconds=options.duration;if(options.useCSSBox!=null)fullCSSBox=options.useCSSBox;if(options.scaleContent!=null)doScaleContent=options.scaleContent;if(options.from!=null) |
|
448 {if(Spry.Effect.Utils.isPercentValue(options.from)) |
|
449 {fromRect.width=originalWidth*(Spry.Effect.Utils.getPercentValue(options.from)/100);fromRect.height=originalHeight*(Spry.Effect.Utils.getPercentValue(options.from)/100);} |
|
450 else |
|
451 {if(calcHeight) |
|
452 {fromRect.height=pixelValue(options.from);fromRect.width=pixelValue(options.from)/propFactor;} |
|
453 else |
|
454 {fromRect.width=pixelValue(options.from);fromRect.height=propFactor*pixelValue(options.from);}}} |
|
455 if(options.to!=null) |
|
456 {if(Spry.Effect.Utils.isPercentValue(options.to)) |
|
457 {toRect.width=originalWidth*(Spry.Effect.Utils.getPercentValue(options.to)/100);toRect.height=originalHeight*(Spry.Effect.Utils.getPercentValue(options.to)/100);} |
|
458 else |
|
459 {if(calcHeight) |
|
460 {toRect.height=pixelValue(options.to);toRect.width=pixelValue(options.to)/propFactor;} |
|
461 else |
|
462 {toRect.width=pixelValue(options.to);toRect.height=propFactor*pixelValue(options.to);}}} |
|
463 if(options.toggle!=null)doToggle=options.toggle;if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;} |
|
464 options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,scaleContent:doScaleContent,useCSSBox:fullCSSBox,fps:fps};var sizeEffect=new Spry.Effect.Size(element,fromRect,toRect,options);this.addParallelEffect(sizeEffect);if(growFromCenter) |
|
465 {Spry.Effect.makePositioned(element);var startOffsetPosition=new Spry.Effect.Utils.Position();startOffsetPosition.x=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(element,"left"),10);startOffsetPosition.y=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(element,"top"),10);if(!startOffsetPosition.x)startOffsetPosition.x=0;if(!startOffsetPosition.y)startOffsetPosition.y=0;options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,from:optionFrom,to:optionTo,fps:fps};var fromPos=new Spry.Effect.Utils.Position;fromPos.x=startOffsetPosition.x+(originalWidth-fromRect.width)/2.0;fromPos.y=startOffsetPosition.y+(originalHeight-fromRect.height)/2.0;var toPos=new Spry.Effect.Utils.Position;toPos.x=startOffsetPosition.x+(originalWidth-toRect.width)/2.0;toPos.y=startOffsetPosition.y+(originalHeight-toRect.height)/2.0;var moveEffect=new Spry.Effect.Move(element,fromPos,toPos,options);this.addParallelEffect(moveEffect);}};Spry.Effect.Grow.prototype=new Spry.Effect.Cluster();Spry.Effect.Grow.prototype.constructor=Spry.Effect.Grow;Spry.Effect.Shake=function(element,options) |
|
466 {if(!this.notStaticAnimator) |
|
467 return Spry.Effect.Utils.showInitError('Shake');Spry.Effect.Cluster.call(this,options);this.options.direction=false;if(this.options.toggle) |
|
468 this.options.toggle=false;this.name='Shake';var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
|
469 return;var durationInMilliseconds=100;var kindOfTransition=Spry.linearTransition;var fps=60;var steps=4;if(options) |
|
470 {if(options.duration!=null)steps=Math.ceil(this.options.duration/durationInMilliseconds)-1;if(options.fps!=null)fps=options.fps;if(options.transition!=null)kindOfTransition=options.transition;} |
|
471 Spry.Effect.makePositioned(element);var startOffsetPosition=new Spry.Effect.Utils.Position();startOffsetPosition.x=parseInt(Spry.Effect.getStyleProp(element,"left"),10);startOffsetPosition.y=parseInt(Spry.Effect.getStyleProp(element,"top"),10);if(!startOffsetPosition.x)startOffsetPosition.x=0;if(!startOffsetPosition.y)startOffsetPosition.y=0;var centerPos=new Spry.Effect.Utils.Position;centerPos.x=startOffsetPosition.x;centerPos.y=startOffsetPosition.y;var rightPos=new Spry.Effect.Utils.Position;rightPos.x=startOffsetPosition.x+20;rightPos.y=startOffsetPosition.y+0;var leftPos=new Spry.Effect.Utils.Position;leftPos.x=startOffsetPosition.x+-20;leftPos.y=startOffsetPosition.y+0;options={duration:Math.ceil(durationInMilliseconds/2),toggle:false,fps:fps,transition:kindOfTransition};var effect=new Spry.Effect.Move(element,centerPos,rightPos,options);this.addNextEffect(effect);options={duration:durationInMilliseconds,toggle:false,fps:fps,transition:kindOfTransition};var effectToRight=new Spry.Effect.Move(element,rightPos,leftPos,options);var effectToLeft=new Spry.Effect.Move(element,leftPos,rightPos,options);for(var i=0;i<steps;i++) |
|
472 {if(i%2==0) |
|
473 this.addNextEffect(effectToRight);else |
|
474 this.addNextEffect(effectToLeft);} |
|
475 var pos=(steps%2==0)?rightPos:leftPos;options={duration:Math.ceil(durationInMilliseconds/2),toggle:false,fps:fps,transition:kindOfTransition};var effect=new Spry.Effect.Move(element,pos,centerPos,options);this.addNextEffect(effect);};Spry.Effect.Shake.prototype=new Spry.Effect.Cluster();Spry.Effect.Shake.prototype.constructor=Spry.Effect.Shake;Spry.Effect.Shake.prototype.doToggle=function(){};Spry.Effect.Squish=function(element,options) |
|
476 {if(!this.notStaticAnimator) |
|
477 return Spry.Effect.Utils.showInitError('Squish');if(!options) |
|
478 options={};if(!options.to) |
|
479 options.to='0%';if(!options.from) |
|
480 options.from='100%';options.growCenter=false;Spry.Effect.Grow.call(this,element,options);this.name='Squish';};Spry.Effect.Squish.prototype=new Spry.Effect.Grow();Spry.Effect.Squish.prototype.constructor=Spry.Effect.Squish;Spry.Effect.Pulsate=function(element,options) |
|
481 {if(!this.notStaticAnimator) |
|
482 return Spry.Effect.Utils.showInitError('Pulsate');Spry.Effect.Cluster.call(this,options);this.options.direction=false;if(this.options.toggle) |
|
483 this.options.toggle=false;var element=Spry.Effect.getElement(element);var originalOpacity=0;this.element=element;if(!this.element) |
|
484 return;this.name='Pulsate';var durationInMilliseconds=100;var fromOpacity=100.0;var toOpacity=0.0;var doToggle=false;var kindOfTransition=Spry.linearTransition;var fps=60;if(/MSIE/.test(navigator.userAgent)) |
|
485 originalOpacity=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(this.element,'filter').replace(/alpha\(opacity=([0-9]{1,3})\)/g,'$1'),10);else |
|
486 originalOpacity=parseInt(Spry.Effect.getStylePropRegardlessOfDisplayState(this.element,'opacity')*100,10);if(isNaN(originalOpacity)){originalOpacity=100;} |
|
487 if(options) |
|
488 {if(options.from!=null){if(Spry.Effect.Utils.isPercentValue(options.from)) |
|
489 fromOpacity=Spry.Effect.Utils.getPercentValue(options.from)*originalOpacity/100;else |
|
490 fromOpacity=options.from;} |
|
491 if(options.to!=null) |
|
492 {if(Spry.Effect.Utils.isPercentValue(options.to)) |
|
493 toOpacity=Spry.Effect.Utils.getPercentValue(options.to)*originalOpacity/100;else |
|
494 toOpacity=options.to;} |
|
495 if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;} |
|
496 options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,fps:fps};fromOpacity=fromOpacity/100.0;toOpacity=toOpacity/100.0;var fadeEffect=new Spry.Effect.Opacity(element,fromOpacity,toOpacity,options);var appearEffect=new Spry.Effect.Opacity(element,toOpacity,fromOpacity,options);var steps=parseInt(this.options.duration/200,10);for(var i=0;i<steps;i++){this.addNextEffect(fadeEffect);this.addNextEffect(appearEffect);}};Spry.Effect.Pulsate.prototype=new Spry.Effect.Cluster();Spry.Effect.Pulsate.prototype.constructor=Spry.Effect.Pulsate;Spry.Effect.Pulsate.prototype.doToggle=function(){};Spry.Effect.Puff=function(element,options) |
|
497 {if(!this.notStaticAnimator) |
|
498 return Spry.Effect.Utils.showInitError('Puff');Spry.Effect.Cluster.call(this,options);var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
|
499 return;this.name='Puff';var doToggle=false;var doScaleContent=false;var durationInMilliseconds=1000;var kindOfTransition=Spry.fifthTransition;var fps=60;Spry.Effect.makePositioned(element);if(options){if(options.toggle!=null)doToggle=options.toggle;if(options.duration!=null)durationInMilliseconds=options.duration;if(options.transition!=null)kindOfTransition=options.transition;if(options.fps!=null)fps=options.fps;} |
|
500 var originalRect=Spry.Effect.getDimensions(element);var startWidth=originalRect.width;var startHeight=originalRect.height;options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,fps:fps};var fromOpacity=1.0;var toOpacity=0.0;var opacityEffect=new Spry.Effect.Opacity(element,fromOpacity,toOpacity,options);this.addParallelEffect(opacityEffect);var fromPos=Spry.Effect.getPosition(element);var toPos=new Spry.Effect.Utils.Position;toPos.x=startWidth/2.0*-1.0;toPos.y=startHeight/2.0*-1.0;options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,from:fromPos,to:toPos,fps:fps};var moveEffect=new Spry.Effect.Move(element,fromPos,toPos,options);this.addParallelEffect(moveEffect);var self=this;this.addObserver({onPreEffect:function(){if(self.direction==Spry.backwards){self.element.style.display='block';}},onPostEffect:function(){if(self.direction==Spry.forwards){self.element.style.display='none';}}});};Spry.Effect.Puff.prototype=new Spry.Effect.Cluster;Spry.Effect.Puff.prototype.constructor=Spry.Effect.Puff;Spry.Effect.DropOut=function(element,options) |
|
501 {if(!this.notStaticAnimator) |
|
502 return Spry.Effect.Utils.showInitError('DropOut');Spry.Effect.Cluster.call(this,options);var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
|
503 return;var durationInMilliseconds=1000;var fps=60;var kindOfTransition=Spry.fifthTransition;var direction=Spry.forwards;var doToggle=false;this.name='DropOut';Spry.Effect.makePositioned(element);if(options) |
|
504 {if(options.duration!=null)durationInMilliseconds=options.duration;if(options.toggle!=null)doToggle=options.toggle;if(options.fps!=null)fps=options.fps;if(options.transition!=null)kindOfTransition=options.transition;if(options.dropIn!=null)direction=-1;} |
|
505 var startOffsetPosition=new Spry.Effect.Utils.Position();startOffsetPosition.x=parseInt(Spry.Effect.getStyleProp(element,"left"),10);startOffsetPosition.y=parseInt(Spry.Effect.getStyleProp(element,"top"),10);if(!startOffsetPosition.x)startOffsetPosition.x=0;if(!startOffsetPosition.y)startOffsetPosition.y=0;var fromPos=new Spry.Effect.Utils.Position;fromPos.x=startOffsetPosition.x+0;fromPos.y=startOffsetPosition.y+0;var toPos=new Spry.Effect.Utils.Position;toPos.x=startOffsetPosition.x+0;toPos.y=startOffsetPosition.y+(direction*160);options={from:fromPos,to:toPos,duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,fps:fps};var moveEffect=new Spry.Effect.Move(element,options.from,options.to,options);this.addParallelEffect(moveEffect);var fromOpacity=1.0;var toOpacity=0.0;options={duration:durationInMilliseconds,toggle:doToggle,transition:kindOfTransition,fps:fps};var opacityEffect=new Spry.Effect.Opacity(element,fromOpacity,toOpacity,options);this.addParallelEffect(opacityEffect);var self=this;this.addObserver({onPreEffect:function(){self.element.style.display='block';},onPostEffect:function(){if(self.direction==Spry.forwards){self.element.style.display='none';}}});};Spry.Effect.DropOut.prototype=new Spry.Effect.Cluster();Spry.Effect.DropOut.prototype.constructor=Spry.Effect.DropOut;Spry.Effect.Fold=function(element,options) |
|
506 {if(!this.notStaticAnimator) |
|
507 return Spry.Effect.Utils.showInitError('Fold');Spry.Effect.Cluster.call(this,options);var element=Spry.Effect.getElement(element);this.element=element;if(!this.element) |
|
508 return;this.name='Fold';var durationInMilliseconds=1000;var doToggle=false;var doScaleContent=true;var fullCSSBox=false;var kindOfTransition=Spry.fifthTransition;var fps=fps;Spry.Effect.makeClipping(element);var originalRect=Spry.Effect.getDimensionsRegardlessOfDisplayState(element);var startWidth=originalRect.width;var startHeight=originalRect.height;var stopWidth=startWidth;var stopHeight=startHeight/5;var fromRect=new Spry.Effect.Utils.Rectangle;fromRect.width=startWidth;fromRect.height=startHeight;var toRect=new Spry.Effect.Utils.Rectangle;toRect.width=stopWidth;toRect.height=stopHeight;if(options) |
|
509 {if(options.duration!=null)durationInMilliseconds=Math.ceil(options.duration/2);if(options.toggle!=null)doToggle=options.toggle;if(options.useCSSBox!=null)fullCSSBox=options.useCSSBox;if(options.fps!=null)fps=options.fps;if(options.transition!=null)kindOfTransition=options.transition;} |
|
510 options={duration:durationInMilliseconds,toggle:doToggle,scaleContent:doScaleContent,useCSSBox:fullCSSBox,transition:kindOfTransition,fps:fps};var sizeEffect=new Spry.Effect.Size(element,fromRect,toRect,options);this.addNextEffect(sizeEffect);fromRect.width=toRect.width;fromRect.height=toRect.height;toRect.width='0%';var sizeEffect=new Spry.Effect.Size(element,fromRect,toRect,options);this.addNextEffect(sizeEffect);};Spry.Effect.Fold.prototype=new Spry.Effect.Cluster();Spry.Effect.Fold.prototype.constructor=Spry.Effect.Fold;Spry.Effect.DoFade=function(element,options) |
|
511 {return Spry.Effect.Utils.DoEffect('Fade',element,options);};Spry.Effect.DoBlind=function(element,options) |
|
512 {return Spry.Effect.Utils.DoEffect('Blind',element,options);};Spry.Effect.DoHighlight=function(element,options) |
|
513 {return Spry.Effect.Utils.DoEffect('Highlight',element,options);};Spry.Effect.DoSlide=function(element,options) |
|
514 {return Spry.Effect.Utils.DoEffect('Slide',element,options);};Spry.Effect.DoGrow=function(element,options) |
|
515 {return Spry.Effect.Utils.DoEffect('Grow',element,options);};Spry.Effect.DoShake=function(element,options) |
|
516 {return Spry.Effect.Utils.DoEffect('Shake',element,options);};Spry.Effect.DoSquish=function(element,options) |
|
517 {return Spry.Effect.Utils.DoEffect('Squish',element,options);};Spry.Effect.DoPulsate=function(element,options) |
|
518 {return Spry.Effect.Utils.DoEffect('Pulsate',element,options);};Spry.Effect.DoPuff=function(element,options) |
|
519 {return Spry.Effect.Utils.DoEffect('Puff',element,options);};Spry.Effect.DoDropOut=function(element,options) |
|
520 {return Spry.Effect.Utils.DoEffect('DropOut',element,options);};Spry.Effect.DoFold=function(element,options) |
|
521 {return Spry.Effect.Utils.DoEffect('Fold',element,options);}; |
|