// Spry.Effect.js - version 0.38 - Spry Pre-Release 1.6.1 // // Copyright (c) 2006. Adobe Systems Incorporated. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of Adobe Systems Incorporated nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. var Spry; if (!Spry) Spry = {}; Spry.forwards = 1; // const Spry.backwards = 2; // const if (!Spry.Effect) Spry.Effect = {}; Spry.Effect.Transitions = { linearTransition: function(time, begin, change, duration) { if (time > duration) return change+begin; return begin + (time / duration) * change; }, sinusoidalTransition: function(time, begin, change, duration) { if (time > duration) return change+begin; return begin + ((-Math.cos((time/duration)*Math.PI)/2) + 0.5) * change; }, squareTransition: function(time, begin, change, duration) { if (time > duration) return change+begin; return begin + Math.pow(time/duration, 2) * change; }, squarerootTransition: function(time, begin, change, duration) { if (time > duration) return change+begin; return begin + Math.sqrt(time/duration) * change; }, fifthTransition: function(time, begin, change, duration) { 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) { 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) { if (time > duration) return change+begin; return begin + (0.5 + Math.sin(17*time/duration)/2) * change; }, growSpecificTransition: function(time, begin, change, duration) { 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) { Spry[trans] = Spry.Effect.Transitions[trans]; } ////////////////////////////////////////////////////////////////////// // // Spry.Effect.Registry // ////////////////////////////////////////////////////////////////////// Spry.Effect.Registry = function() { this.effects = []; }; Spry.Effect.Registry.prototype.getRegisteredEffect = function(element, options) { var a = {}; a.element = Spry.Effect.getElement(element); a.options = options; for (var i=0; i0) { if(isFirstEntry) { camelizedString = oStringList[i]; isFirstEntry = false; } else { var s = oStringList[i]; camelizedString += s.charAt(0).toUpperCase() + s.substring(1); } } } return camelizedString; }; Spry.Effect.Utils.isPercentValue = function(value) { var result = false; if (typeof value == 'string' && value.length > 0 && value.lastIndexOf("%") > 0) result = true; return result; }; Spry.Effect.Utils.getPercentValue = function(value) { var result = 0; try { result = Number(value.substring(0, value.lastIndexOf("%"))); } catch (e) {Spry.Effect.Utils.showError('Spry.Effect.Utils.getPercentValue: ' + e);} return result; }; Spry.Effect.Utils.getPixelValue = function(value) { var result = 0; if (typeof value == 'number') return value; var unitIndex = value.lastIndexOf("px"); if ( unitIndex == -1) unitIndex = value.length; try { result = parseInt(value.substring(0, unitIndex), 10); } catch (e){} return result; }; Spry.Effect.Utils.getFirstChildElement = function(node) { if (node) { var childCurr = node.firstChild; while (childCurr) { if (childCurr.nodeType == 1) // Node.ELEMENT_NODE return childCurr; childCurr = childCurr.nextSibling; } } return null; }; Spry.Effect.Utils.fetchChildImages = function(startEltIn, targetImagesOut) { if(!startEltIn || startEltIn.nodeType != 1 || !targetImagesOut) return; if(startEltIn.hasChildNodes()) { var childImages = startEltIn.getElementsByTagName('img'); var imageCnt = childImages.length; for(var i=0; i