From c6b1bea6104671d64fb324e3b7811b3295a4f3a7 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Thu, 23 Feb 2012 12:43:42 +0100 Subject: [PATCH] add scrollx1 flash src & add flash file to builder --- builder.php | 1 + .../caurina/transitions/AuxFunctions.as | 92 ++ .../caurina/transitions/Equations.as | 714 +++++++++++ .../caurina/transitions/PropertyInfoObj.as | 90 ++ .../caurina/transitions/SpecialProperty.as | 49 + .../transitions/SpecialPropertyModifier.as | 42 + .../transitions/SpecialPropertySplitter.as | 42 + .../caurina/transitions/TweenListObj.as | 236 ++++ .../caurina/transitions/Tweener.as | 1105 +++++++++++++++++ .../transitions/properties/ColorShortcuts.as | 479 +++++++ .../transitions/properties/CurveModifiers.as | 109 ++ .../properties/DisplayShortcuts.as | 161 +++ .../transitions/properties/FilterShortcuts.as | 495 ++++++++ .../transitions/properties/SoundShortcuts.as | 93 ++ .../transitions/properties/TextShortcuts.as | 157 +++ flash/ImageDisplayx1/homelink.fla | Bin 0 -> 7835 bytes 16 files changed, 3865 insertions(+) create mode 100644 flash/ImageDisplayx1/caurina/transitions/AuxFunctions.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/Equations.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/PropertyInfoObj.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/SpecialProperty.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/SpecialPropertyModifier.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/SpecialPropertySplitter.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/TweenListObj.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/Tweener.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/properties/ColorShortcuts.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/properties/CurveModifiers.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/properties/DisplayShortcuts.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/properties/FilterShortcuts.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/properties/SoundShortcuts.as create mode 100644 flash/ImageDisplayx1/caurina/transitions/properties/TextShortcuts.as create mode 100644 flash/ImageDisplayx1/homelink.fla diff --git a/builder.php b/builder.php index cf6db2f814..59abc7d85f 100755 --- a/builder.php +++ b/builder.php @@ -74,6 +74,7 @@ $finder ->name('hudson') ->name('.svn') ->name('.git') + ->name('flash') ->ignoreDotFiles(false) ->ignoreVCS(false) ->in(__DIR__); diff --git a/flash/ImageDisplayx1/caurina/transitions/AuxFunctions.as b/flash/ImageDisplayx1/caurina/transitions/AuxFunctions.as new file mode 100644 index 0000000000..21704689f2 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/AuxFunctions.as @@ -0,0 +1,92 @@ +package caurina.transitions { + + /** + * Generic, auxiliary functions + * + * @author Zeh Fernando + * @version 1.0.0 + * @private + */ + + public class AuxFunctions { + + /** + * Gets the R (xx0000) bits from a number + * + * @param p_num Number Color number (ie, 0xffff00) + * @return Number The R value + */ + public static function numberToR(p_num:Number):Number { + // The initial & is meant to crop numbers bigger than 0xffffff + return (p_num & 0xff0000) >> 16; + } + + /** + * Gets the G (00xx00) bits from a number + * + * @param p_num Number Color number (ie, 0xffff00) + * @return Number The G value + */ + public static function numberToG(p_num:Number):Number { + return (p_num & 0xff00) >> 8; + } + + /** + * Gets the B (0000xx) bits from a number + * + * @param p_num Number Color number (ie, 0xffff00) + * @return Number The B value + */ + public static function numberToB(p_num:Number):Number { + return (p_num & 0xff); + } + + /** + * Checks whether a string is on an array + * + * @param p_string String String to search for + * @param p_array Array Array to be searched + * @return Boolean Whether the array contains the string or not + */ + public static function isInArray(p_string:String, p_array:Array):Boolean { + var l:uint = p_array.length; + for (var i:uint = 0; i < l; i++) { + if (p_array[i] == p_string) return true; + } + return false; + } + + /** + * Returns the number of properties an object has + * + * @param p_object Object Target object with a number of properties + * @return Number Number of total properties the object has + */ + public static function getObjectLength(p_object:Object):uint { + var totalProperties:uint = 0; + for (var pName:String in p_object) totalProperties ++; + return totalProperties; + } + + /* Takes a variable number of objects as parameters and "adds" their properties, from left to right. If a latter object defines a property as null, it will be removed from the final object + * @param args Object(s) A variable number of objects + * @return Object An object with the sum of all paremeters added as properties. + */ + public static function concatObjects(...args) : Object{ + var finalObject : Object = {}; + var currentObject : Object; + for (var i : int = 0; i < args.length; i++){ + currentObject = args[i]; + for (var prop : String in currentObject){ + if (currentObject[prop] == null){ + // delete in case is null + delete finalObject[prop]; + }else{ + finalObject[prop] = currentObject[prop]; + } + } + } + return finalObject; + } + } +} diff --git a/flash/ImageDisplayx1/caurina/transitions/Equations.as b/flash/ImageDisplayx1/caurina/transitions/Equations.as new file mode 100644 index 0000000000..d9893c4940 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/Equations.as @@ -0,0 +1,714 @@ +/** + * Equations + * Main equations for the Tweener class + * + * @author Zeh Fernando, Nate Chatellier + * @version 1.0.2 + */ + +/* +Disclaimer for Robert Penner's Easing Equations license: + +TERMS OF USE - EASING EQUATIONS + +Open source under the BSD License. + +Copyright © 2001 Robert Penner +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 the author nor the names of 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. +*/ + +package caurina.transitions { + + public class Equations { + + /** + * There's no constructor. + * @private + */ + public function Equations () { + trace ("Equations is a static class and should not be instantiated.") + } + + /** + * Registers all the equations to the Tweener class, so they can be found by the direct string parameters. + * This method doesn't actually have to be used - equations can always be referenced by their full function + * names. But "registering" them make them available as their shorthand string names. + */ + public static function init():void { + Tweener.registerTransition("easenone", easeNone); + Tweener.registerTransition("linear", easeNone); // mx.transitions.easing.None.easeNone + + Tweener.registerTransition("easeinquad", easeInQuad); // mx.transitions.easing.Regular.easeIn + Tweener.registerTransition("easeoutquad", easeOutQuad); // mx.transitions.easing.Regular.easeOut + Tweener.registerTransition("easeinoutquad", easeInOutQuad); // mx.transitions.easing.Regular.easeInOut + Tweener.registerTransition("easeoutinquad", easeOutInQuad); + + Tweener.registerTransition("easeincubic", easeInCubic); + Tweener.registerTransition("easeoutcubic", easeOutCubic); + Tweener.registerTransition("easeinoutcubic", easeInOutCubic); + Tweener.registerTransition("easeoutincubic", easeOutInCubic); + + Tweener.registerTransition("easeinquart", easeInQuart); + Tweener.registerTransition("easeoutquart", easeOutQuart); + Tweener.registerTransition("easeinoutquart", easeInOutQuart); + Tweener.registerTransition("easeoutinquart", easeOutInQuart); + + Tweener.registerTransition("easeinquint", easeInQuint); + Tweener.registerTransition("easeoutquint", easeOutQuint); + Tweener.registerTransition("easeinoutquint", easeInOutQuint); + Tweener.registerTransition("easeoutinquint", easeOutInQuint); + + Tweener.registerTransition("easeinsine", easeInSine); + Tweener.registerTransition("easeoutsine", easeOutSine); + Tweener.registerTransition("easeinoutsine", easeInOutSine); + Tweener.registerTransition("easeoutinsine", easeOutInSine); + + Tweener.registerTransition("easeincirc", easeInCirc); + Tweener.registerTransition("easeoutcirc", easeOutCirc); + Tweener.registerTransition("easeinoutcirc", easeInOutCirc); + Tweener.registerTransition("easeoutincirc", easeOutInCirc); + + Tweener.registerTransition("easeinexpo", easeInExpo); // mx.transitions.easing.Strong.easeIn + Tweener.registerTransition("easeoutexpo", easeOutExpo); // mx.transitions.easing.Strong.easeOut + Tweener.registerTransition("easeinoutexpo", easeInOutExpo); // mx.transitions.easing.Strong.easeInOut + Tweener.registerTransition("easeoutinexpo", easeOutInExpo); + + Tweener.registerTransition("easeinelastic", easeInElastic); // mx.transitions.easing.Elastic.easeIn + Tweener.registerTransition("easeoutelastic", easeOutElastic); // mx.transitions.easing.Elastic.easeOut + Tweener.registerTransition("easeinoutelastic", easeInOutElastic); // mx.transitions.easing.Elastic.easeInOut + Tweener.registerTransition("easeoutinelastic", easeOutInElastic); + + Tweener.registerTransition("easeinback", easeInBack); // mx.transitions.easing.Back.easeIn + Tweener.registerTransition("easeoutback", easeOutBack); // mx.transitions.easing.Back.easeOut + Tweener.registerTransition("easeinoutback", easeInOutBack); // mx.transitions.easing.Back.easeInOut + Tweener.registerTransition("easeoutinback", easeOutInBack); + + Tweener.registerTransition("easeinbounce", easeInBounce); // mx.transitions.easing.Bounce.easeIn + Tweener.registerTransition("easeoutbounce", easeOutBounce); // mx.transitions.easing.Bounce.easeOut + Tweener.registerTransition("easeinoutbounce", easeInOutBounce); // mx.transitions.easing.Bounce.easeInOut + Tweener.registerTransition("easeoutinbounce", easeOutInBounce); + } + + // ================================================================================================================================== + // TWEENING EQUATIONS functions ----------------------------------------------------------------------------------------------------- + // (the original equations are Robert Penner's work as mentioned on the disclaimer) + + /** + * Easing equation function for a simple linear tweening, with no easing. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeNone (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*t/d + b; + } + + /** + * Easing equation function for a quadratic (t^2) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInQuad (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*(t/=d)*t + b; + } + + /** + * Easing equation function for a quadratic (t^2) easing out: decelerating to zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutQuad (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return -c *(t/=d)*(t-2) + b; + } + + /** + * Easing equation function for a quadratic (t^2) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutQuad (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + } + + /** + * Easing equation function for a quadratic (t^2) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInQuad (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutQuad (t*2, b, c/2, d, p_params); + return easeInQuad((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a cubic (t^3) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInCubic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*(t/=d)*t*t + b; + } + + /** + * Easing equation function for a cubic (t^3) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutCubic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*((t=t/d-1)*t*t + 1) + b; + } + + /** + * Easing equation function for a cubic (t^3) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutCubic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + } + + /** + * Easing equation function for a cubic (t^3) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInCubic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutCubic (t*2, b, c/2, d, p_params); + return easeInCubic((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a quartic (t^4) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInQuart (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*(t/=d)*t*t*t + b; + } + + /** + * Easing equation function for a quartic (t^4) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutQuart (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + } + + /** + * Easing equation function for a quartic (t^4) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutQuart (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + } + + /** + * Easing equation function for a quartic (t^4) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInQuart (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutQuart (t*2, b, c/2, d, p_params); + return easeInQuart((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a quintic (t^5) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInQuint (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*(t/=d)*t*t*t*t + b; + } + + /** + * Easing equation function for a quintic (t^5) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutQuint (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + } + + /** + * Easing equation function for a quintic (t^5) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutQuint (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + } + + /** + * Easing equation function for a quintic (t^5) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInQuint (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutQuint (t*2, b, c/2, d, p_params); + return easeInQuint((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInSine (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + } + + /** + * Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutSine (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c * Math.sin(t/d * (Math.PI/2)) + b; + } + + /** + * Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutSine (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + } + + /** + * Easing equation function for a sinusoidal (sin(t)) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInSine (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutSine (t*2, b, c/2, d, p_params); + return easeInSine((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for an exponential (2^t) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInExpo (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b - c * 0.001; + } + + /** + * Easing equation function for an exponential (2^t) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutExpo (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return (t==d) ? b+c : c * 1.001 * (-Math.pow(2, -10 * t/d) + 1) + b; + } + + /** + * Easing equation function for an exponential (2^t) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutExpo (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b - c * 0.0005; + return c/2 * 1.0005 * (-Math.pow(2, -10 * --t) + 2) + b; + } + + /** + * Easing equation function for an exponential (2^t) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInExpo (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutExpo (t*2, b, c/2, d, p_params); + return easeInExpo((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a circular (sqrt(1-t^2)) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInCirc (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + } + + /** + * Easing equation function for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutCirc (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + } + + /** + * Easing equation function for a circular (sqrt(1-t^2)) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutCirc (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + } + + /** + * Easing equation function for a circular (sqrt(1-t^2)) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInCirc (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutCirc (t*2, b, c/2, d, p_params); + return easeInCirc((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for an elastic (exponentially decaying sine wave) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param a Amplitude. + * @param p Period. + * @return The correct value. + */ + public static function easeInElastic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t==0) return b; + if ((t/=d)==1) return b+c; + var p:Number = !Boolean(p_params) || isNaN(p_params.period) ? d*.3 : p_params.period; + var s:Number; + var a:Number = !Boolean(p_params) || isNaN(p_params.amplitude) ? 0 : p_params.amplitude; + if (!Boolean(a) || a < Math.abs(c)) { + a = c; + s = p/4; + } else { + s = p/(2*Math.PI) * Math.asin (c/a); + } + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + } + + /** + * Easing equation function for an elastic (exponentially decaying sine wave) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param a Amplitude. + * @param p Period. + * @return The correct value. + */ + public static function easeOutElastic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t==0) return b; + if ((t/=d)==1) return b+c; + var p:Number = !Boolean(p_params) || isNaN(p_params.period) ? d*.3 : p_params.period; + var s:Number; + var a:Number = !Boolean(p_params) || isNaN(p_params.amplitude) ? 0 : p_params.amplitude; + if (!Boolean(a) || a < Math.abs(c)) { + a = c; + s = p/4; + } else { + s = p/(2*Math.PI) * Math.asin (c/a); + } + return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b); + } + + /** + * Easing equation function for an elastic (exponentially decaying sine wave) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param a Amplitude. + * @param p Period. + * @return The correct value. + */ + public static function easeInOutElastic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t==0) return b; + if ((t/=d/2)==2) return b+c; + var p:Number = !Boolean(p_params) || isNaN(p_params.period) ? d*(.3*1.5) : p_params.period; + var s:Number; + var a:Number = !Boolean(p_params) || isNaN(p_params.amplitude) ? 0 : p_params.amplitude; + if (!Boolean(a) || a < Math.abs(c)) { + a = c; + s = p/4; + } else { + s = p/(2*Math.PI) * Math.asin (c/a); + } + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + } + + /** + * Easing equation function for an elastic (exponentially decaying sine wave) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param a Amplitude. + * @param p Period. + * @return The correct value. + */ + public static function easeOutInElastic (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutElastic (t*2, b, c/2, d, p_params); + return easeInElastic((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + * @return The correct value. + */ + public static function easeInBack (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + var s:Number = !Boolean(p_params) || isNaN(p_params.overshoot) ? 1.70158 : p_params.overshoot; + return c*(t/=d)*t*((s+1)*t - s) + b; + } + + /** + * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + * @return The correct value. + */ + public static function easeOutBack (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + var s:Number = !Boolean(p_params) || isNaN(p_params.overshoot) ? 1.70158 : p_params.overshoot; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + } + + /** + * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + * @return The correct value. + */ + public static function easeInOutBack (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + var s:Number = !Boolean(p_params) || isNaN(p_params.overshoot) ? 1.70158 : p_params.overshoot; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + } + + /** + * Easing equation function for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @param s Overshoot ammount: higher s means greater overshoot (0 produces cubic easing with no overshoot, and the default value of 1.70158 produces an overshoot of 10 percent). + * @return The correct value. + */ + public static function easeOutInBack (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutBack (t*2, b, c/2, d, p_params); + return easeInBack((t*2)-d, b+c/2, c/2, d, p_params); + } + + /** + * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in: accelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInBounce (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + return c - easeOutBounce (d-t, 0, c, d) + b; + } + + /** + * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out: decelerating from zero velocity. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutBounce (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + } + + /** + * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing in/out: acceleration until halfway, then deceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeInOutBounce (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeInBounce (t*2, 0, c, d) * .5 + b; + else return easeOutBounce (t*2-d, 0, c, d) * .5 + c*.5 + b; + } + + /** + * Easing equation function for a bounce (exponentially decaying parabolic bounce) easing out/in: deceleration until halfway, then acceleration. + * + * @param t Current time (in frames or seconds). + * @param b Starting value. + * @param c Change needed in value. + * @param d Expected easing duration (in frames or seconds). + * @return The correct value. + */ + public static function easeOutInBounce (t:Number, b:Number, c:Number, d:Number, p_params:Object = null):Number { + if (t < d/2) return easeOutBounce (t*2, b, c/2, d, p_params); + return easeInBounce((t*2)-d, b+c/2, c/2, d, p_params); + } + } +} diff --git a/flash/ImageDisplayx1/caurina/transitions/PropertyInfoObj.as b/flash/ImageDisplayx1/caurina/transitions/PropertyInfoObj.as new file mode 100644 index 0000000000..132aaa5c0e --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/PropertyInfoObj.as @@ -0,0 +1,90 @@ +package caurina.transitions { + + /** + * PropertyInfoObj + * An object containing the updating info for a given property (its starting value, and its final value) + * + * @author Zeh Fernando + * @version 1.0.0 + * @private + */ + + public class PropertyInfoObj { + + public var valueStart :Number; // Starting value of the tweening (null if not started yet) + public var valueComplete :Number; // Final desired value + public var originalValueComplete :Object; // Final desired value as declared initially + public var arrayIndex :Number; // Index (if this is an array item) + public var extra :Object; // Additional parameters, used by some special properties + public var isSpecialProperty :Boolean; // Whether or not this is a special property instead of a direct one + public var hasModifier :Boolean; // Whether or not it has a modifier function + public var modifierFunction :Function; // Modifier function, if any + public var modifierParameters :Array; // Additional array of modifier parameters + + // ================================================================================================================================== + // CONSTRUCTOR function ------------------------------------------------------------------------------------------------------------- + + /** + * Initializes the basic PropertyInfoObj. + * + * @param p_valueStart Number Starting value of the tweening (null if not started yet) + * @param p_valueComplete Number Final (desired) property value + */ + function PropertyInfoObj(p_valueStart:Number, p_valueComplete:Number, p_originalValueComplete:Object, p_arrayIndex:Number, p_extra:Object, p_isSpecialProperty:Boolean, p_modifierFunction:Function, p_modifierParameters:Array) { + valueStart = p_valueStart; + valueComplete = p_valueComplete; + originalValueComplete = p_originalValueComplete; + arrayIndex = p_arrayIndex; + extra = p_extra; + isSpecialProperty = p_isSpecialProperty; + hasModifier = Boolean(p_modifierFunction); + modifierFunction = p_modifierFunction; + modifierParameters = p_modifierParameters; + } + + + // ================================================================================================================================== + // OTHER functions ------------------------------------------------------------------------------------------------------------------ + + /** + * Clones this property info and returns the new PropertyInfoObj + * + * @param omitEvents Boolean Whether or not events such as onStart (and its parameters) should be omitted + * @return TweenListObj A copy of this object + */ + public function clone():PropertyInfoObj { + var nProperty:PropertyInfoObj = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters); + return nProperty; + } + + /** + * Returns this object described as a String. + * + * @return String The description of this object. + */ + public function toString():String { + var returnStr:String = "\n[PropertyInfoObj "; + returnStr += "valueStart:" + String(valueStart); + returnStr += ", "; + returnStr += "valueComplete:" + String(valueComplete); + returnStr += ", "; + returnStr += "originalValueComplete:" + String(originalValueComplete); + returnStr += ", "; + returnStr += "arrayIndex:" + String(arrayIndex); + returnStr += ", "; + returnStr += "extra:" + String(extra); + returnStr += ", "; + returnStr += "isSpecialProperty:" + String(isSpecialProperty); + returnStr += ", "; + returnStr += "hasModifier:" + String(hasModifier); + returnStr += ", "; + returnStr += "modifierFunction:" + String(modifierFunction); + returnStr += ", "; + returnStr += "modifierParameters:" + String(modifierParameters); + returnStr += "]\n"; + return returnStr; + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/SpecialProperty.as b/flash/ImageDisplayx1/caurina/transitions/SpecialProperty.as new file mode 100644 index 0000000000..a261597483 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/SpecialProperty.as @@ -0,0 +1,49 @@ +package caurina.transitions { + + /** + * SpecialProperty + * A kind of a getter/setter for special properties + * + * @author Zeh Fernando + * @version 1.0.0 + * @private + */ + + public class SpecialProperty { + + public var getValue:Function; // (p_obj:Object, p_parameters:Array, p_extra:Object): Number + public var setValue:Function; // (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object): Void + public var parameters:Array; + public var preProcess:Function; // (p_obj:Object, p_parameters:Array, p_originalValueComplete:Object, p_extra:Object): Number + + /** + * Builds a new special property object. + * + * @param p_getFunction Function Reference to the function used to get the special property value + * @param p_setFunction Function Reference to the function used to set the special property value + */ + public function SpecialProperty (p_getFunction:Function, p_setFunction:Function, p_parameters:Array = null, p_preProcessFunction:Function = null) { + getValue = p_getFunction; + setValue = p_setFunction; + parameters = p_parameters; + preProcess = p_preProcessFunction; + } + + /** + * Converts the instance to a string that can be used when trace()ing the object + */ + public function toString():String { + var value:String = ""; + value += "[SpecialProperty "; + value += "getValue:"+String(getValue); + value += ", "; + value += "setValue:"+String(setValue); + value += ", "; + value += "parameters:"+String(parameters); + value += ", "; + value += "preProcess:"+String(preProcess); + value += "]"; + return value; + } + } +} diff --git a/flash/ImageDisplayx1/caurina/transitions/SpecialPropertyModifier.as b/flash/ImageDisplayx1/caurina/transitions/SpecialPropertyModifier.as new file mode 100644 index 0000000000..049af18f65 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/SpecialPropertyModifier.as @@ -0,0 +1,42 @@ +package caurina.transitions { + + /** + * SpecialPropertyModifier + * A special property which actually acts on other properties + * + * @author Zeh Fernando + * @version 1.0.0 + * @private + */ + + public class SpecialPropertyModifier { + + public var modifyValues:Function; + public var getValue:Function; + + /** + * Builds a new special property modifier object. + * + * @param p_modifyFunction Function Function that returns the modifider parameters. + */ + public function SpecialPropertyModifier (p_modifyFunction:Function, p_getFunction:Function) { + modifyValues = p_modifyFunction; + getValue = p_getFunction; + } + + /** + * Converts the instance to a string that can be used when trace()ing the object + */ + public function toString():String { + var value:String = ""; + value += "[SpecialPropertyModifier "; + value += "modifyValues:"+String(modifyValues); + value += ", "; + value += "getValue:"+String(getValue); + value += "]"; + return value; + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/SpecialPropertySplitter.as b/flash/ImageDisplayx1/caurina/transitions/SpecialPropertySplitter.as new file mode 100644 index 0000000000..eeef9033f7 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/SpecialPropertySplitter.as @@ -0,0 +1,42 @@ +package caurina.transitions { + + /** + * SpecialPropertySplitter + * A proxy setter for special properties + * + * @author Zeh Fernando + * @version 1.0.0 + * @private + */ + + public class SpecialPropertySplitter { + + public var parameters:Array; + public var splitValues:Function; + + /** + * Builds a new group special property object. + * + * @param p_splitFunction Function Reference to the function used to split a value + */ + public function SpecialPropertySplitter (p_splitFunction:Function, p_parameters:Array) { + splitValues = p_splitFunction; + parameters = p_parameters; + } + + /** + * Converts the instance to a string that can be used when trace()ing the object + */ + public function toString():String { + var value:String = ""; + value += "[SpecialPropertySplitter "; + value += "splitValues:"+String(splitValues); // .toString(); + value += ", "; + value += "parameters:"+String(parameters); + value += "]"; + return value; + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/TweenListObj.as b/flash/ImageDisplayx1/caurina/transitions/TweenListObj.as new file mode 100644 index 0000000000..77fa1fef39 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/TweenListObj.as @@ -0,0 +1,236 @@ +package caurina.transitions { + import caurina.transitions.AuxFunctions; + /** + * The tween list object. Stores all of the properties and information that pertain to individual tweens. + * + * @author Nate Chatellier, Zeh Fernando + * @version 1.0.4 + * @private + */ + + public class TweenListObj { + + public var scope :Object; // Object affected by this tweening + public var properties :Object; // List of properties that are tweened (PropertyInfoObj instances) + // .valueStart :Number // Initial value of the property + // .valueComplete :Number // The value the property should have when completed + public var timeStart :Number; // Time when this tweening should start + public var timeComplete :Number; // Time when this tweening should end + public var useFrames :Boolean; // Whether or not to use frames instead of time + public var transition :Function; // Equation to control the transition animation + public var transitionParams :Object; // Additional parameters for the transition + public var onStart :Function; // Function to be executed on the object when the tween starts (once) + public var onUpdate :Function; // Function to be executed on the object when the tween updates (several times) + public var onComplete :Function; // Function to be executed on the object when the tween completes (once) + public var onOverwrite :Function; // Function to be executed on the object when the tween is overwritten + public var onError :Function; // Function to be executed if an error is thrown when tweener exectues a callback (onComplete, onUpdate etc) + public var onStartParams :Array; // Array of parameters to be passed for the event + public var onUpdateParams :Array; // Array of parameters to be passed for the event + public var onCompleteParams :Array; // Array of parameters to be passed for the event + public var onOverwriteParams :Array; // Array of parameters to be passed for the event + public var onStartScope :Object; // Scope in which the event function is ran + public var onUpdateScope :Object; // Scope in which the event function is ran + public var onCompleteScope :Object; // Scope in which the event function is ran + public var onOverwriteScope :Object; // Scope in which the event function is ran + public var onErrorScope :Object; // Scope in which the event function is ran + public var rounded :Boolean; // Use rounded values when updating + public var isPaused :Boolean; // Whether or not this tween is paused + public var timePaused :Number; // Time when this tween was paused + public var isCaller :Boolean; // Whether or not this tween is a "caller" tween + public var count :Number; // Number of times this caller should be called + public var timesCalled :Number; // How many times the caller has already been called ("caller" tweens only) + public var waitFrames :Boolean; // Whether or not this caller should wait at least one frame for each call execution ("caller" tweens only) + public var skipUpdates :Number; // How many updates should be skipped (default = 0; 1 = update-skip-update-skip...) + public var updatesSkipped :Number; // How many updates have already been skipped + public var hasStarted :Boolean; // Whether or not this tween has already started + + // ================================================================================================================================== + // CONSTRUCTOR function ------------------------------------------------------------------------------------------------------------- + + /** + * Initializes the basic TweenListObj. + * + * @param p_scope Object Object affected by this tweening + * @param p_timeStart Number Time when this tweening should start + * @param p_timeComplete Number Time when this tweening should end + * @param p_useFrames Boolean Whether or not to use frames instead of time + * @param p_transition Function Equation to control the transition animation + */ + function TweenListObj(p_scope:Object, p_timeStart:Number, p_timeComplete:Number, p_useFrames:Boolean, p_transition:Function, p_transitionParams:Object) { + scope = p_scope; + timeStart = p_timeStart; + timeComplete = p_timeComplete; + useFrames = p_useFrames; + transition = p_transition; + transitionParams = p_transitionParams; + + // Other default information + properties = new Object(); + isPaused = false; + timePaused = undefined; + isCaller = false; + updatesSkipped = 0; + timesCalled = 0; + skipUpdates = 0; + hasStarted = false; + } + + + // ================================================================================================================================== + // OTHER functions ------------------------------------------------------------------------------------------------------------------ + + /** + * Clones this tweening and returns the new TweenListObj + * + * @param omitEvents Boolean Whether or not events such as onStart (and its parameters) should be omitted + * @return TweenListObj A copy of this object + */ + public function clone(omitEvents:Boolean):TweenListObj { + var nTween:TweenListObj = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams); + nTween.properties = new Array(); + for (var pName:String in properties) { + nTween.properties[pName] = properties[pName].clone(); + } + nTween.skipUpdates = skipUpdates; + nTween.updatesSkipped = updatesSkipped; + if (!omitEvents) { + nTween.onStart = onStart; + nTween.onUpdate = onUpdate; + nTween.onComplete = onComplete; + nTween.onOverwrite = onOverwrite; + nTween.onError = onError; + nTween.onStartParams = onStartParams; + nTween.onUpdateParams = onUpdateParams; + nTween.onCompleteParams = onCompleteParams; + nTween.onOverwriteParams = onOverwriteParams; + nTween.onStartScope = onStartScope; + nTween.onUpdateScope = onUpdateScope; + nTween.onCompleteScope = onCompleteScope; + nTween.onOverwriteScope = onOverwriteScope; + nTween.onErrorScope = onErrorScope; + } + nTween.rounded = rounded; + nTween.isPaused = isPaused; + nTween.timePaused = timePaused; + nTween.isCaller = isCaller; + nTween.count = count; + nTween.timesCalled = timesCalled; + nTween.waitFrames = waitFrames; + nTween.hasStarted = hasStarted; + + return nTween; + } + + /** + * Returns this object described as a String. + * + * @return String The description of this object. + */ + public function toString():String { + var returnStr:String = "\n[TweenListObj "; + returnStr += "scope:" + String(scope); + returnStr += ", properties:"; + var isFirst:Boolean = true; + for (var i:String in properties) { + if (!isFirst) returnStr += ","; + returnStr += "[name:"+properties[i].name; + returnStr += ",valueStart:"+properties[i].valueStart; + returnStr += ",valueComplete:"+properties[i].valueComplete; + returnStr += "]"; + isFirst = false; + } + returnStr += ", timeStart:" + String(timeStart); + returnStr += ", timeComplete:" + String(timeComplete); + returnStr += ", useFrames:" + String(useFrames); + returnStr += ", transition:" + String(transition); + returnStr += ", transitionParams:" + String(transitionParams); + + if (skipUpdates) returnStr += ", skipUpdates:" + String(skipUpdates); + if (updatesSkipped) returnStr += ", updatesSkipped:" + String(updatesSkipped); + + if (Boolean(onStart)) returnStr += ", onStart:" + String(onStart); + if (Boolean(onUpdate)) returnStr += ", onUpdate:" + String(onUpdate); + if (Boolean(onComplete)) returnStr += ", onComplete:" + String(onComplete); + if (Boolean(onOverwrite)) returnStr += ", onOverwrite:" + String(onOverwrite); + if (Boolean(onError)) returnStr += ", onError:" + String(onError); + + if (onStartParams) returnStr += ", onStartParams:" + String(onStartParams); + if (onUpdateParams) returnStr += ", onUpdateParams:" + String(onUpdateParams); + if (onCompleteParams) returnStr += ", onCompleteParams:" + String(onCompleteParams); + if (onOverwriteParams) returnStr += ", onOverwriteParams:" + String(onOverwriteParams); + + if (onStartScope) returnStr += ", onStartScope:" + String(onStartScope); + if (onUpdateScope) returnStr += ", onUpdateScope:" + String(onUpdateScope); + if (onCompleteScope) returnStr += ", onCompleteScope:" + String(onCompleteScope); + if (onOverwriteScope) returnStr += ", onOverwriteScope:" + String(onOverwriteScope); + if (onErrorScope) returnStr += ", onErrorScope:" + String(onErrorScope); + + if (rounded) returnStr += ", rounded:" + String(rounded); + if (isPaused) returnStr += ", isPaused:" + String(isPaused); + if (timePaused) returnStr += ", timePaused:" + String(timePaused); + if (isCaller) returnStr += ", isCaller:" + String(isCaller); + if (count) returnStr += ", count:" + String(count); + if (timesCalled) returnStr += ", timesCalled:" + String(timesCalled); + if (waitFrames) returnStr += ", waitFrames:" + String(waitFrames); + if (hasStarted) returnStr += ", hasStarted:" + String(hasStarted); + + returnStr += "]\n"; + return returnStr; + } + + /** + * Checks if p_obj "inherits" properties from other objects, as set by the "base" property. Will create a new object, leaving others intact. + * o_bj.base can be an object or an array of objects. Properties are collected from the first to the last element of the "base" filed, with higher + * indexes overwritting smaller ones. Does not modify any of the passed objects, but makes a shallow copy of all properties. + * + * @param p_obj Object Object that should be tweened: a movieclip, textfield, etc.. OR an array of objects + * @return Object A new object with all properties from the p_obj and p_obj.base. + */ + + public static function makePropertiesChain(p_obj : Object) : Object{ + // Is this object inheriting properties from another object? + var baseObject : Object = p_obj.base; + if(baseObject){ + // object inherits. Are we inheriting from an object or an array + var chainedObject : Object = {}; + var chain : Object; + if (baseObject is Array){ + // Inheritance chain is the base array + chain = []; + // make a shallow copy + for (var k : Number = 0 ; k< baseObject.length; k++) chain.push(baseObject[k]); + }else{ + // Only one object to be added to the array + chain = [baseObject]; + } + // add the final object to the array, so it's properties are added last + chain.push(p_obj); + var currChainObj : Object; + // Loops through each object adding it's property to the final object + var len : Number = chain.length; + for(var i : Number = 0; i < len ; i ++){ + if(chain[i]["base"]){ + // deal with recursion: watch the order! "parent" base must be concatenated first! + currChainObj = AuxFunctions.concatObjects( makePropertiesChain(chain[i]["base"] ), chain[i]); + }else{ + currChainObj = chain[i] ; + } + chainedObject = AuxFunctions.concatObjects(chainedObject, currChainObj ); + } + if( chainedObject["base"]){ + delete chainedObject["base"]; + } + return chainedObject; + }else{ + // No inheritance, just return the object it self + return p_obj; + } + } + + + } + + + + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/Tweener.as b/flash/ImageDisplayx1/caurina/transitions/Tweener.as new file mode 100644 index 0000000000..7afa244a51 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/Tweener.as @@ -0,0 +1,1105 @@ +/** + * Tweener + * Transition controller for movieclips, sounds, textfields and other objects + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.31.71 + */ + +/* +Licensed under the MIT License + +Copyright (c) 2006-2007 Zeh Fernando and Nate Chatellier + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +http://code.google.com/p/tweener/ +http://code.google.com/p/tweener/wiki/License +*/ + +package caurina.transitions { + + import flash.display.*; + import flash.events.Event; + import flash.utils.getTimer; + + public class Tweener { + + private static var __tweener_controller__:MovieClip; // Used to ensure the stage copy is always accessible (garbage collection) + + private static var _engineExists:Boolean = false; // Whether or not the engine is currently running + private static var _inited:Boolean = false; // Whether or not the class has been initiated + private static var _currentTime:Number; // The current time. This is generic for all tweenings for a "time grid" based update + private static var _currentTimeFrame:Number; // The current frame. Used on frame-based tweenings + + private static var _tweenList:Array; // List of active tweens + + private static var _timeScale:Number = 1; // Time scale (default = 1) + + private static var _transitionList:Object; // List of "pre-fetched" transition functions + private static var _specialPropertyList:Object; // List of special properties + private static var _specialPropertyModifierList:Object; // List of special property modifiers + private static var _specialPropertySplitterList:Object; // List of special property splitters + + + /** + * There's no constructor. + * @private + */ + public function Tweener () { + trace ("Tweener is a static class and should not be instantiated."); + } + + // ================================================================================================================================== + // TWEENING CONTROL functions ------------------------------------------------------------------------------------------------------- + + /** + * Adds a new tweening. + * + * @param (first-n param) Object Object that should be tweened: a movieclip, textfield, etc.. OR an array of objects + * @param (last param) Object Object containing the specified parameters in any order, as well as the properties that should be tweened and their values + * @param .time Number Time in seconds or frames for the tweening to take (defaults 2) + * @param .delay Number Delay time (defaults 0) + * @param .useFrames Boolean Whether to use frames instead of seconds for time control (defaults false) + * @param .transition String/Function Type of transition equation... (defaults to "easeoutexpo") + * @param .onStart Function * Direct property, See the TweenListObj class + * @param .onUpdate Function * Direct property, See the TweenListObj class + * @param .onComplete Function * Direct property, See the TweenListObj class + * @param .onOverwrite Function * Direct property, See the TweenListObj class + * @param .onStartParams Array * Direct property, See the TweenListObj class + * @param .onUpdateParams Array * Direct property, See the TweenListObj class + * @param .onCompleteParams Array * Direct property, See the TweenListObj class + * @param .onOverwriteParams Array * Direct property, See the TweenListObj class + * @param .rounded Boolean * Direct property, See the TweenListObj class + * @param .skipUpdates Number * Direct property, See the TweenListObj class + * @return Boolean TRUE if the tween was successfully added, FALSE if otherwise + */ + public static function addTween (p_scopes:Object = null, p_parameters:Object = null):Boolean { + if (!Boolean(p_scopes)) return false; + + var i:Number, j:Number, istr:String; + + var rScopes:Array; // List of objects to tween + if (p_scopes is Array) { + // The first argument is an array + rScopes = p_scopes.concat(); + } else { + // The first argument(s) is(are) object(s) + rScopes = [p_scopes]; + } + + // make properties chain ("inheritance") + var p_obj:Object = TweenListObj.makePropertiesChain(p_parameters); + + // Creates the main engine if it isn't active + if (!_inited) init(); + if (!_engineExists || !Boolean(__tweener_controller__)) startEngine(); // Quick fix for Flash not resetting the vars on double ctrl+enter... + + // Creates a "safer", more strict tweening object + var rTime:Number = (isNaN(p_obj.time) ? 0 : p_obj.time); // Real time + var rDelay:Number = (isNaN(p_obj.delay) ? 0 : p_obj.delay); // Real delay + + // Creates the property list; everything that isn't a hardcoded variable + var rProperties:Array = new Array(); // Object containing a list of PropertyInfoObj instances + var restrictedWords:Object = {time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, transitionParams:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, onError:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true, onStartScope:true, onUpdateScope:true, onCompleteScope:true, onOverwriteScope:true, onErrorScope:true}; + var modifiedProperties:Object = new Object(); + for (istr in p_obj) { + if (!restrictedWords[istr]) { + // It's an additional pair, so adds + if (_specialPropertySplitterList[istr]) { + // Special property splitter + var splitProperties:Array = _specialPropertySplitterList[istr].splitValues(p_obj[istr], _specialPropertySplitterList[istr].parameters); + for (i = 0; i < splitProperties.length; i++) { + if (_specialPropertySplitterList[splitProperties[i].name]) { + var splitProperties2:Array = _specialPropertySplitterList[splitProperties[i].name].splitValues(splitProperties[i].value, _specialPropertySplitterList[splitProperties[i].name].parameters); + for (j = 0; j < splitProperties2.length; j++) { + rProperties[splitProperties2[j].name] = {valueStart:undefined, valueComplete:splitProperties2[j].value, arrayIndex:splitProperties2[j].arrayIndex, isSpecialProperty:false}; + } + } else { + rProperties[splitProperties[i].name] = {valueStart:undefined, valueComplete:splitProperties[i].value, arrayIndex:splitProperties[i].arrayIndex, isSpecialProperty:false}; + } + } + } else if (_specialPropertyModifierList[istr] != undefined) { + // Special property modifier + var tempModifiedProperties:Array = _specialPropertyModifierList[istr].modifyValues(p_obj[istr]); + for (i = 0; i < tempModifiedProperties.length; i++) { + modifiedProperties[tempModifiedProperties[i].name] = {modifierParameters:tempModifiedProperties[i].parameters, modifierFunction:_specialPropertyModifierList[istr].getValue}; + } + } else { + // Regular property or special property, just add the property normally + rProperties[istr] = {valueStart:undefined, valueComplete:p_obj[istr]}; + } + } + } + + // Verifies whether the properties exist or not, for warning messages + for (istr in rProperties) { + if (_specialPropertyList[istr] != undefined) { + rProperties[istr].isSpecialProperty = true; + } else { + if (rScopes[0][istr] == undefined) { + printError("The property '" + istr + "' doesn't seem to be a normal object property of " + String(rScopes[0]) + " or a registered special property."); + } + } + } + + // Adds the modifiers to the list of properties + for (istr in modifiedProperties) { + if (rProperties[istr] != undefined) { + rProperties[istr].modifierParameters = modifiedProperties[istr].modifierParameters; + rProperties[istr].modifierFunction = modifiedProperties[istr].modifierFunction; + } + + } + + var rTransition:Function; // Real transition + + if (typeof p_obj.transition == "string") { + // String parameter, transition names + var trans:String = p_obj.transition.toLowerCase(); + rTransition = _transitionList[trans]; + } else { + // Proper transition function + rTransition = p_obj.transition; + } + if (!Boolean(rTransition)) rTransition = _transitionList["easeoutexpo"]; + + var nProperties:Object; + var nTween:TweenListObj; + var myT:Number; + + for (i = 0; i < rScopes.length; i++) { + // Makes a copy of the properties + nProperties = new Object(); + for (istr in rProperties) { + nProperties[istr] = new PropertyInfoObj(rProperties[istr].valueStart, rProperties[istr].valueComplete, rProperties[istr].valueComplete, rProperties[istr].arrayIndex, {}, rProperties[istr].isSpecialProperty, rProperties[istr].modifierFunction, rProperties[istr].modifierParameters); + } + + if (p_obj.useFrames == true) { + nTween = new TweenListObj( + /* scope */ rScopes[i], + /* timeStart */ _currentTimeFrame + (rDelay / _timeScale), + /* timeComplete */ _currentTimeFrame + ((rDelay + rTime) / _timeScale), + /* useFrames */ true, + /* transition */ rTransition, + p_obj.transitionParams + ); + } else { + nTween = new TweenListObj( + /* scope */ rScopes[i], + /* timeStart */ _currentTime + ((rDelay * 1000) / _timeScale), + /* timeComplete */ _currentTime + (((rDelay * 1000) + (rTime * 1000)) / _timeScale), + /* useFrames */ false, + /* transition */ rTransition, + p_obj.transitionParams + ); + } + + nTween.properties = nProperties; + nTween.onStart = p_obj.onStart; + nTween.onUpdate = p_obj.onUpdate; + nTween.onComplete = p_obj.onComplete; + nTween.onOverwrite = p_obj.onOverwrite; + nTween.onError = p_obj.onError; + nTween.onStartParams = p_obj.onStartParams; + nTween.onUpdateParams = p_obj.onUpdateParams; + nTween.onCompleteParams = p_obj.onCompleteParams; + nTween.onOverwriteParams = p_obj.onOverwriteParams; + nTween.onStartScope = p_obj.onStartScope; + nTween.onUpdateScope = p_obj.onUpdateScope; + nTween.onCompleteScope = p_obj.onCompleteScope; + nTween.onOverwriteScope = p_obj.onOverwriteScope; + nTween.onErrorScope = p_obj.onErrorScope; + nTween.rounded = p_obj.rounded; + nTween.skipUpdates = p_obj.skipUpdates; + + // Remove other tweenings that occur at the same time + removeTweensByTime(nTween.scope, nTween.properties, nTween.timeStart, nTween.timeComplete); + + // And finally adds it to the list + _tweenList.push(nTween); + + // Immediate update and removal if it's an immediate tween -- if not deleted, it executes at the end of this frame execution + if (rTime == 0 && rDelay == 0) { + myT = _tweenList.length-1; + updateTweenByIndex(myT); + removeTweenByIndex(myT); + } + } + + return true; + } + + // A "caller" is like this: [ | | | ||] got it? :) + // this function is crap - should be fixed later/extend on addTween() + + /** + * Adds a new caller tweening. + * + * @param (first-n param) Object that should be tweened: a movieclip, textfield, etc.. OR an array of objects + * @param (last param) Object containing the specified parameters in any order, as well as the properties that should be tweened and their values + * @param .time Number Time in seconds or frames for the tweening to take (defaults 2) + * @param .delay Number Delay time (defaults 0) + * @param .count Number Number of times this caller should be called + * @param .transition String/Function Type of transition equation... (defaults to "easeoutexpo") + * @param .onStart Function Event called when tween starts + * @param .onUpdate Function Event called when tween updates + * @param .onComplete Function Event called when tween ends + * @param .waitFrames Boolean Whether to wait (or not) one frame for each call + * @return true if the tween was successfully added, false if otherwise. + */ + public static function addCaller (p_scopes:Object = null, p_parameters:Object = null):Boolean { + if (!Boolean(p_scopes)) return false; + + var i:Number; + + var rScopes:Array; // List of objects to tween + if (p_scopes is Array) { + // The first argument is an array + rScopes = p_scopes.concat(); + } else { + // The first argument(s) is(are) object(s) + rScopes = [p_scopes]; + } + + var p_obj:Object = p_parameters; + + // Creates the main engine if it isn't active + if (!_inited) init(); + if (!_engineExists || !Boolean(__tweener_controller__)) startEngine(); // Quick fix for Flash not resetting the vars on double ctrl+enter... + + // Creates a "safer", more strict tweening object + var rTime:Number = (isNaN(p_obj.time) ? 0 : p_obj.time); // Real time + var rDelay:Number = (isNaN(p_obj.delay) ? 0 : p_obj.delay); // Real delay + + var rTransition:Function; // Real transition + if (typeof p_obj.transition == "string") { + // String parameter, transition names + var trans:String = p_obj.transition.toLowerCase(); + rTransition = _transitionList[trans]; + } else { + // Proper transition function + rTransition = p_obj.transition; + } + if (!Boolean(rTransition)) rTransition = _transitionList["easeoutexpo"]; + + var nTween:TweenListObj; + var myT:Number; + for (i = 0; i < rScopes.length; i++) { + + if (p_obj.useFrames == true) { + nTween = new TweenListObj( + /* scope */ rScopes[i], + /* timeStart */ _currentTimeFrame + (rDelay / _timeScale), + /* timeComplete */ _currentTimeFrame + ((rDelay + rTime) / _timeScale), + /* useFrames */ true, + /* transition */ rTransition, + p_obj.transitionParams + ); + } else { + nTween = new TweenListObj( + /* scope */ rScopes[i], + /* timeStart */ _currentTime + ((rDelay * 1000) / _timeScale), + /* timeComplete */ _currentTime + (((rDelay * 1000) + (rTime * 1000)) / _timeScale), + /* useFrames */ false, + /* transition */ rTransition, + p_obj.transitionParams + ); + } + + nTween.properties = null; + nTween.onStart = p_obj.onStart; + nTween.onUpdate = p_obj.onUpdate; + nTween.onComplete = p_obj.onComplete; + nTween.onOverwrite = p_obj.onOverwrite; + nTween.onStartParams = p_obj.onStartParams; + nTween.onUpdateParams = p_obj.onUpdateParams; + nTween.onCompleteParams = p_obj.onCompleteParams; + nTween.onOverwriteParams = p_obj.onOverwriteParams; + nTween.onStartScope = p_obj.onStartScope; + nTween.onUpdateScope = p_obj.onUpdateScope; + nTween.onCompleteScope = p_obj.onCompleteScope; + nTween.onOverwriteScope = p_obj.onOverwriteScope; + nTween.onErrorScope = p_obj.onErrorScope; + nTween.isCaller = true; + nTween.count = p_obj.count; + nTween.waitFrames = p_obj.waitFrames; + + // And finally adds it to the list + _tweenList.push(nTween); + + // Immediate update and removal if it's an immediate tween -- if not deleted, it executes at the end of this frame execution + if (rTime == 0 && rDelay == 0) { + myT = _tweenList.length-1; + updateTweenByIndex(myT); + removeTweenByIndex(myT); + } + } + + return true; + } + + /** + * Remove an specified tweening of a specified object the tweening list, if it conflicts with the given time. + * + * @param p_scope Object List of objects affected + * @param p_properties Object List of properties affected (PropertyInfoObj instances) + * @param p_timeStart Number Time when the new tween starts + * @param p_timeComplete Number Time when the new tween ends + * @return Boolean Whether or not it actually deleted something + */ + public static function removeTweensByTime (p_scope:Object, p_properties:Object, p_timeStart:Number, p_timeComplete:Number):Boolean { + var removed:Boolean = false; + var removedLocally:Boolean; + + var i:uint; + var tl:uint = _tweenList.length; + var pName:String; + + for (i = 0; i < tl; i++) { + if (Boolean(_tweenList[i]) && p_scope == _tweenList[i].scope) { + // Same object... + if (p_timeComplete > _tweenList[i].timeStart && p_timeStart < _tweenList[i].timeComplete) { + // New time should override the old one... + removedLocally = false; + for (pName in _tweenList[i].properties) { + if (Boolean(p_properties[pName])) { + // Same object, same property + // Finally, remove this old tweening and use the new one + if (Boolean(_tweenList[i].onOverwrite)) { + var eventScope:Object = Boolean(_tweenList[i].onOverwriteScope) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope; + try { + _tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams); + } catch(e:Error) { + handleError(_tweenList[i], e, "onOverwrite"); + } + } + _tweenList[i].properties[pName] = undefined; + delete _tweenList[i].properties[pName]; + removedLocally = true; + removed = true; + } + } + if (removedLocally) { + // Verify if this can be deleted + if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0) removeTweenByIndex(i); + } + } + } + } + + return removed; + } + + /** + * Remove tweenings from a given object from the tweening list. + * + * @param p_tween Object Object that must have its tweens removed + * @param (2nd-last params) Object Property(ies) that must be removed + * @return Boolean Whether or not it successfully removed this tweening + */ + public static function removeTweens (p_scope:Object, ...args):Boolean { + // Create the property list + var properties:Array = new Array(); + var i:uint; + for (i = 0; i < args.length; i++) { + if (typeof(args[i]) == "string" && !AuxFunctions.isInArray(args[i], properties)) properties.push(args[i]); + } + // Call the affect function on the specified properties + return affectTweens(removeTweenByIndex, p_scope, properties); + } + + + /** + * Remove all tweenings from the engine. + * + * @return true if it successfully removed any tweening, false if otherwise. + */ + public static function removeAllTweens ():Boolean { + if (!Boolean(_tweenList)) return false; + var removed:Boolean = false; + var i:uint; + for (i = 0; i<_tweenList.length; i++) { + removeTweenByIndex(i); + removed = true; + } + return removed; + } + + /** + * Pause tweenings for a given object. + * + * @param p_scope Object that must have its tweens paused + * @param (2nd-last params) Property(ies) that must be paused + * @return true if it successfully paused any tweening, false if otherwise. + */ + public static function pauseTweens (p_scope:Object, ...args):Boolean { + // Create the property list + var properties:Array = new Array(); + var i:uint; + for (i = 0; i < args.length; i++) { + if (typeof(args[i]) == "string" && !AuxFunctions.isInArray(args[i], properties)) properties.push(args[i]); + } + // Call the affect function on the specified properties + return affectTweens(pauseTweenByIndex, p_scope, properties); + } + + /** + * Pause all tweenings on the engine. + * + * @return true if it successfully paused any tweening, false if otherwise. + * @see #resumeAllTweens() + */ + public static function pauseAllTweens ():Boolean { + if (!Boolean(_tweenList)) return false; + var paused:Boolean = false; + var i:uint; + for (i = 0; i < _tweenList.length; i++) { + pauseTweenByIndex(i); + paused = true; + } + return paused; + } + + /** + * Resume tweenings from a given object. + * + * @param p_scope Object Object that must have its tweens resumed + * @param (2nd-last params) Object Property(ies) that must be resumed + * @return Boolean Whether or not it successfully resumed something + */ + public static function resumeTweens (p_scope:Object, ...args):Boolean { + // Create the property list + var properties:Array = new Array(); + var i:uint; + for (i = 0; i < args.length; i++) { + if (typeof(args[i]) == "string" && !AuxFunctions.isInArray(args[i], properties)) properties.push(args[i]); + } + // Call the affect function on the specified properties + return affectTweens(resumeTweenByIndex, p_scope, properties); + } + + /** + * Resume all tweenings on the engine. + * + * @return true if it successfully resumed any tweening, false if otherwise. + * @see #pauseAllTweens() + */ + public static function resumeAllTweens ():Boolean { + if (!Boolean(_tweenList)) return false; + var resumed:Boolean = false; + var i:uint; + for (i = 0; i < _tweenList.length; i++) { + resumeTweenByIndex(i); + resumed = true; + } + return resumed; + } + + /** + * Do some generic action on specific tweenings (pause, resume, remove, more?) + * + * @param p_function Function Function to run on the tweenings that match + * @param p_scope Object Object that must have its tweens affected by the function + * @param p_properties Array Array of strings that must be affected + * @return Boolean Whether or not it successfully affected something + */ + private static function affectTweens (p_affectFunction:Function, p_scope:Object, p_properties:Array):Boolean { + var affected:Boolean = false; + var i:uint; + + if (!Boolean(_tweenList)) return false; + + for (i = 0; i < _tweenList.length; i++) { + if (_tweenList[i] && _tweenList[i].scope == p_scope) { + if (p_properties.length == 0) { + // Can affect everything + p_affectFunction(i); + affected = true; + } else { + // Must check whether this tween must have specific properties affected + var affectedProperties:Array = new Array(); + var j:uint; + for (j = 0; j < p_properties.length; j++) { + if (Boolean(_tweenList[i].properties[p_properties[j]])) { + affectedProperties.push(p_properties[j]); + } + } + if (affectedProperties.length > 0) { + // This tween has some properties that need to be affected + var objectProperties:uint = AuxFunctions.getObjectLength(_tweenList[i].properties); + if (objectProperties == affectedProperties.length) { + // The list of properties is the same as all properties, so affect it all + p_affectFunction(i); + affected = true; + } else { + // The properties are mixed, so split the tween and affect only certain specific properties + var slicedTweenIndex:uint = splitTweens(i, affectedProperties); + p_affectFunction(slicedTweenIndex); + affected = true; + } + } + } + } + } + return affected; + } + + /** + * Splits a tweening in two + * + * @param p_tween Number Object that must have its tweens split + * @param p_properties Array Array of strings containing the list of properties that must be separated + * @return Number The index number of the new tween + */ + public static function splitTweens (p_tween:Number, p_properties:Array):uint { + // First, duplicates + var originalTween:TweenListObj = _tweenList[p_tween]; + var newTween:TweenListObj = originalTween.clone(false); + + // Now, removes tweenings where needed + var i:uint; + var pName:String; + + // Removes the specified properties from the old one + for (i = 0; i < p_properties.length; i++) { + pName = p_properties[i]; + if (Boolean(originalTween.properties[pName])) { + originalTween.properties[pName] = undefined; + delete originalTween.properties[pName]; + } + } + + // Removes the unspecified properties from the new one + var found:Boolean; + for (pName in newTween.properties) { + found = false; + for (i = 0; i < p_properties.length; i++) { + if (p_properties[i] == pName) { + found = true; + break; + } + } + if (!found) { + newTween.properties[pName] = undefined; + delete newTween.properties[pName]; + } + } + + // If there are empty property lists, a cleanup is done on the next updateTweens() cycle + _tweenList.push(newTween); + return (_tweenList.length - 1); + + } + + // ================================================================================================================================== + // ENGINE functions ----------------------------------------------------------------------------------------------------------------- + + /** + * Updates all existing tweenings. + * + * @return Boolean FALSE if no update was made because there's no tweening (even delayed ones) + */ + private static function updateTweens ():Boolean { + if (_tweenList.length == 0) return false; + var i:int; + for (i = 0; i < _tweenList.length; i++) { + // Looping throught each Tweening and updating the values accordingly + if (_tweenList[i] == undefined || !_tweenList[i].isPaused) { + if (!updateTweenByIndex(i)) removeTweenByIndex(i); + if (_tweenList[i] == null) { + removeTweenByIndex(i, true); + i--; + } + } + } + + return true; + } + + /** + * Remove a specific tweening from the tweening list. + * + * @param p_tween Number Index of the tween to be removed on the tweenings list + * @return Boolean Whether or not it successfully removed this tweening + */ + public static function removeTweenByIndex (i:Number, p_finalRemoval:Boolean = false):Boolean { + _tweenList[i] = null; + if (p_finalRemoval) _tweenList.splice(i, 1); + return true; + } + + /** + * Pauses a specific tween. + * + * @param p_tween Number Index of the tween to be paused + * @return Boolean Whether or not it successfully paused this tweening + */ + public static function pauseTweenByIndex (p_tween:Number):Boolean { + var tTweening:TweenListObj = _tweenList[p_tween]; // Shortcut to this tweening + if (tTweening == null || tTweening.isPaused) return false; + tTweening.timePaused = getCurrentTweeningTime(tTweening); + tTweening.isPaused = true; + + return true; + } + + /** + * Resumes a specific tween. + * + * @param p_tween Number Index of the tween to be resumed + * @return Boolean Whether or not it successfully resumed this tweening + */ + public static function resumeTweenByIndex (p_tween:Number):Boolean { + var tTweening:TweenListObj = _tweenList[p_tween]; // Shortcut to this tweening + if (tTweening == null || !tTweening.isPaused) return false; + var cTime:Number = getCurrentTweeningTime(tTweening); + tTweening.timeStart += cTime - tTweening.timePaused; + tTweening.timeComplete += cTime - tTweening.timePaused; + tTweening.timePaused = undefined; + tTweening.isPaused = false; + + return true; + } + + /** + * Updates a specific tween. + * + * @param i Number Index (from the tween list) of the tween that should be updated + * @return Boolean FALSE if it's already finished and should be deleted, TRUE if otherwise + */ + private static function updateTweenByIndex (i:Number):Boolean { + + var tTweening:TweenListObj = _tweenList[i]; // Shortcut to this tweening + + if (tTweening == null || !Boolean(tTweening.scope)) return false; + + var isOver:Boolean = false; // Whether or not it's over the update time + var mustUpdate:Boolean; // Whether or not it should be updated (skipped if false) + + var nv:Number; // New value for each property + + var t:Number; // current time (frames, seconds) + var b:Number; // beginning value + var c:Number; // change in value + var d:Number; // duration (frames, seconds) + + var pName:String; // Property name, used in loops + var eventScope:Object; // Event scope, used to call functions + + // Shortcut stuff for speed + var tScope:Object; // Current scope + var cTime:Number = getCurrentTweeningTime(tTweening); + var tProperty:Object; // Property being checked + + if (cTime >= tTweening.timeStart) { + // Can already start + + tScope = tTweening.scope; + + if (tTweening.isCaller) { + // It's a 'caller' tween + do { + t = ((tTweening.timeComplete - tTweening.timeStart)/tTweening.count) * (tTweening.timesCalled+1); + b = tTweening.timeStart; + c = tTweening.timeComplete - tTweening.timeStart; + d = tTweening.timeComplete - tTweening.timeStart; + nv = tTweening.transition(t, b, c, d); + + if (cTime >= nv) { + if (Boolean(tTweening.onUpdate)) { + eventScope = Boolean(tTweening.onUpdateScope) ? tTweening.onUpdateScope : tScope; + try { + tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams); + } catch(e:Error) { + handleError(tTweening, e, "onUpdate"); + } + } + + tTweening.timesCalled++; + if (tTweening.timesCalled >= tTweening.count) { + isOver = true; + break; + } + if (tTweening.waitFrames) break; + } + + } while (cTime >= nv); + } else { + // It's a normal transition tween + + mustUpdate = tTweening.skipUpdates < 1 || !tTweening.skipUpdates || tTweening.updatesSkipped >= tTweening.skipUpdates; + + if (cTime >= tTweening.timeComplete) { + isOver = true; + mustUpdate = true; + } + + if (!tTweening.hasStarted) { + // First update, read all default values (for proper filter tweening) + if (Boolean(tTweening.onStart)) { + eventScope = Boolean(tTweening.onStartScope) ? tTweening.onStartScope : tScope; + try { + tTweening.onStart.apply(eventScope, tTweening.onStartParams); + } catch(e:Error) { + handleError(tTweening, e, "onStart"); + } + } + var pv:Number; + for (pName in tTweening.properties) { + if (tTweening.properties[pName].isSpecialProperty) { + // It's a special property, tunnel via the special property function + if (Boolean(_specialPropertyList[pName].preProcess)) { + tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra); + } + pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra); + } else { + // Directly read property + pv = tScope[pName]; + } + tTweening.properties[pName].valueStart = isNaN(pv) ? tTweening.properties[pName].valueComplete : pv; + } + mustUpdate = true; + tTweening.hasStarted = true; + } + + if (mustUpdate) { + for (pName in tTweening.properties) { + tProperty = tTweening.properties[pName]; + + if (isOver) { + // Tweening time has finished, just set it to the final value + nv = tProperty.valueComplete; + } else { + if (tProperty.hasModifier) { + // Modified + t = cTime - tTweening.timeStart; + d = tTweening.timeComplete - tTweening.timeStart; + nv = tTweening.transition(t, 0, 1, d, tTweening.transitionParams); + nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters); + } else { + // Normal update + t = cTime - tTweening.timeStart; + b = tProperty.valueStart; + c = tProperty.valueComplete - tProperty.valueStart; + d = tTweening.timeComplete - tTweening.timeStart; + nv = tTweening.transition(t, b, c, d, tTweening.transitionParams); + } + } + + if (tTweening.rounded) nv = Math.round(nv); + if (tProperty.isSpecialProperty) { + // It's a special property, tunnel via the special property method + _specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra); + } else { + // Directly set property + tScope[pName] = nv; + } + } + + tTweening.updatesSkipped = 0; + + if (Boolean(tTweening.onUpdate)) { + eventScope = Boolean(tTweening.onUpdateScope) ? tTweening.onUpdateScope : tScope; + try { + tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams); + } catch(e:Error) { + handleError(tTweening, e, "onUpdate"); + } + } + } else { + tTweening.updatesSkipped++; + } + } + + if (isOver && Boolean(tTweening.onComplete)) { + eventScope = Boolean(tTweening.onCompleteScope) ? tTweening.onCompleteScope : tScope; + try { + tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams); + } catch(e:Error) { + handleError(tTweening, e, "onComplete"); + } + } + + return (!isOver); + } + + // On delay, hasn't started, so returns true + return (true); + + } + + /** + * Initiates the Tweener--should only be ran once. + */ + public static function init(...rest):void { + _inited = true; + + // Registers all default equations + _transitionList = new Object(); + Equations.init(); + + // Registers all default special properties + _specialPropertyList = new Object(); + _specialPropertyModifierList = new Object(); + _specialPropertySplitterList = new Object(); + } + + /** + * Adds a new function to the available transition list "shortcuts". + * + * @param p_name String Shorthand transition name + * @param p_function Function The proper equation function + */ + public static function registerTransition(p_name:String, p_function:Function): void { + if (!_inited) init(); + _transitionList[p_name] = p_function; + } + + /** + * Adds a new special property to the available special property list. + * + * @param p_name Name of the "special" property. + * @param p_getFunction Function that gets the value. + * @param p_setFunction Function that sets the value. + */ + public static function registerSpecialProperty(p_name:String, p_getFunction:Function, p_setFunction:Function, p_parameters:Array = null, p_preProcessFunction:Function = null): void { + if (!_inited) init(); + var sp:SpecialProperty = new SpecialProperty(p_getFunction, p_setFunction, p_parameters, p_preProcessFunction); + _specialPropertyList[p_name] = sp; + } + + /** + * Adds a new special property modifier to the available modifier list. + * + * @param p_name Name of the "special" property modifier. + * @param p_modifyFunction Function that modifies the value. + * @param p_getFunction Function that gets the value. + */ + public static function registerSpecialPropertyModifier(p_name:String, p_modifyFunction:Function, p_getFunction:Function): void { + if (!_inited) init(); + var spm:SpecialPropertyModifier = new SpecialPropertyModifier(p_modifyFunction, p_getFunction); + _specialPropertyModifierList[p_name] = spm; + } + + /** + * Adds a new special property splitter to the available splitter list. + * + * @param p_name Name of the "special" property splitter. + * @param p_splitFunction Function that splits the value. + */ + public static function registerSpecialPropertySplitter(p_name:String, p_splitFunction:Function, p_parameters:Array = null): void { + if (!_inited) init(); + var sps:SpecialPropertySplitter = new SpecialPropertySplitter(p_splitFunction, p_parameters); + _specialPropertySplitterList[p_name] = sps; + } + + /** + * Starts the Tweener class engine. It is supposed to be running every time a tween exists. + */ + private static function startEngine():void { + _engineExists = true; + _tweenList = new Array(); + + __tweener_controller__ = new MovieClip(); + __tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); + + _currentTimeFrame = 0; + updateTime(); + } + + /** + * Stops the Tweener class engine. + */ + private static function stopEngine():void { + _engineExists = false; + _tweenList = null; + _currentTime = 0; + _currentTimeFrame = 0; + __tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); + __tweener_controller__ = null; + } + + /** + * Updates the time to enforce time grid-based updates. + */ + public static function updateTime():void { + _currentTime = getTimer(); + } + + /** + * Updates the current frame count + */ + public static function updateFrame():void { + _currentTimeFrame++; + } + + /** + * Ran once every frame. It's the main engine; updates all existing tweenings. + */ + public static function onEnterFrame(e:Event):void { + updateTime(); + updateFrame(); + var hasUpdated:Boolean = false; + hasUpdated = updateTweens(); + if (!hasUpdated) stopEngine(); // There's no tweening to update or wait, so it's better to stop the engine + } + + /** + * Sets the new time scale. + * + * @param p_time Number New time scale (0.5 = slow, 1 = normal, 2 = 2x fast forward, etc) + */ + public static function setTimeScale(p_time:Number):void { + var i:Number; + var cTime:Number; + + if (isNaN(p_time)) p_time = 1; + if (p_time < 0.00001) p_time = 0.00001; + if (p_time != _timeScale) { + if (_tweenList != null) { + // Multiplies all existing tween times accordingly + for (i = 0; i<_tweenList.length; i++) { + cTime = getCurrentTweeningTime(_tweenList[i]); + _tweenList[i].timeStart = cTime - ((cTime - _tweenList[i].timeStart) * _timeScale / p_time); + _tweenList[i].timeComplete = cTime - ((cTime - _tweenList[i].timeComplete) * _timeScale / p_time); + if (_tweenList[i].timePaused != undefined) _tweenList[i].timePaused = cTime - ((cTime - _tweenList[i].timePaused) * _timeScale / p_time); + } + } + // Sets the new timescale value (for new tweenings) + _timeScale = p_time; + } + } + + + // ================================================================================================================================== + // AUXILIARY functions -------------------------------------------------------------------------------------------------------------- + + /** + * Finds whether or not an object has any tweening. + * + * @param p_scope Target object. + * @return true if there's a tweening occuring on this object (paused, delayed, or active), false if otherwise. + */ + public static function isTweening (p_scope:Object):Boolean { + if (!Boolean(_tweenList)) return false; + var i:uint; + + for (i = 0; i<_tweenList.length; i++) { + if (Boolean(_tweenList[i]) && _tweenList[i].scope == p_scope) { + return true; + } + } + return false; + } + + /** + * Returns an array containing a list of the properties being tweened for this object. + * + * @param p_scope Target object. + * @return Total number of properties being tweened (including delayed or paused tweens). + */ + public static function getTweens (p_scope:Object):Array { + if (!Boolean(_tweenList)) return []; + var i:uint; + var pName:String; + var tList:Array = new Array(); + + for (i = 0; i<_tweenList.length; i++) { + if (Boolean(_tweenList[i]) && _tweenList[i].scope == p_scope) { + for (pName in _tweenList[i].properties) tList.push(pName); + } + } + return tList; + } + + /** + * Returns the number of properties being tweened for a given object. + * + * @param p_scope Target object. + * @return Total number of properties being tweened (including delayed or paused tweens). + */ + public static function getTweenCount (p_scope:Object):Number { + if (!Boolean(_tweenList)) return 0; + var i:uint; + var c:Number = 0; + + for (i = 0; i<_tweenList.length; i++) { + if (Boolean(_tweenList[i]) && _tweenList[i].scope == p_scope) { + c += AuxFunctions.getObjectLength(_tweenList[i].properties); + } + } + return c; + } + + + /* Handles errors when Tweener executes any callbacks (onStart, onUpdate, etc) + * If the TweenListObj specifies an onError callback it well get called, passing the Error object and the current scope as parameters. If no onError callback is specified, it will trace a stackTrace. + */ + private static function handleError(pTweening : TweenListObj, pError : Error, pCallBackName : String) : void{ + // do we have an error handler? + if (Boolean(pTweening.onError) && (pTweening.onError is Function)){ + // yup, there's a handler. Wrap this in a try catch in case the onError throws an error itself. + var eventScope:Object = Boolean(pTweening.onErrorScope) ? pTweening.onErrorScope : pTweening.scope; + try { + pTweening.onError.apply(eventScope, [pTweening.scope, pError]); + } catch (metaError : Error){ + printError(String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n " + pError.getStackTrace() + "\nonError error: " + metaError.getStackTrace()); + } + } else { + // no handler, simply trace the stack trace: + if (!Boolean(pTweening.onError)){ + printError(String(pTweening.scope) + " raised an error while executing the '" + pCallBackName + "'handler. \n" + pError.getStackTrace() ); + } + } + } + + /** + * Get the current tweening time (no matter if it uses frames or time as basis), given a specific tweening + * + * @param p_tweening TweenListObj Tween information + */ + public static function getCurrentTweeningTime(p_tweening:Object):Number { + return p_tweening.useFrames ? _currentTimeFrame : _currentTime; + } + + /** + * Return the current tweener version + * + * @return String The number of the current Tweener version + */ + public static function getVersion():String { + return "AS3 1.31.71"; + } + + + // ================================================================================================================================== + // DEBUG functions ------------------------------------------------------------------------------------------------------------------ + + /** + * Output an error message + * + * @param p_message String The error message to output + */ + public static function printError(p_message:String): void { + // + trace("## [Tweener] Error: "+p_message); + } + + } +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/ColorShortcuts.as b/flash/ImageDisplayx1/caurina/transitions/properties/ColorShortcuts.as new file mode 100644 index 0000000000..a5493aa0d5 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/ColorShortcuts.as @@ -0,0 +1,479 @@ +package caurina.transitions.properties { + + /** + * properties.ColorShortcuts + * List of default special color properties (normal and splitter properties) for the Tweener class + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import flash.geom.ColorTransform; + import flash.filters.ColorMatrixFilter; + + import caurina.transitions.Tweener; + import caurina.transitions.AuxFunctions; + + public class ColorShortcuts { + + // Sources: + // http://www.graficaobscura.com/matrix/index.html + // And mario Klingemann's ColorMatrix class as mentioned on the credits: + // http://www.quasimondo.com/archives/000565.php + + // Defines luminance using sRGB luminance + private static var LUMINANCE_R:Number = 0.212671; + private static var LUMINANCE_G:Number = 0.715160; + private static var LUMINANCE_B:Number = 0.072169; + + /** + * There's no constructor. + */ + public function ColorShortcuts () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init(): void { + + // Normal properties + Tweener.registerSpecialProperty("_color_ra", _oldColor_property_get, _oldColor_property_set, ["redMultiplier"]); + Tweener.registerSpecialProperty("_color_rb", _color_property_get, _color_property_set, ["redOffset"]); + Tweener.registerSpecialProperty("_color_ga", _oldColor_property_get, _oldColor_property_set, ["greenMultiplier"]); + Tweener.registerSpecialProperty("_color_gb", _color_property_get, _color_property_set, ["greenOffset"]); + Tweener.registerSpecialProperty("_color_ba", _oldColor_property_get, _oldColor_property_set, ["blueMultiplier"]); + Tweener.registerSpecialProperty("_color_bb", _color_property_get, _color_property_set, ["blueOffset"]); + Tweener.registerSpecialProperty("_color_aa", _oldColor_property_get, _oldColor_property_set, ["alphaMultiplier"]); + Tweener.registerSpecialProperty("_color_ab", _color_property_get, _color_property_set, ["alphaOffset"]); + + Tweener.registerSpecialProperty("_color_redMultiplier", _color_property_get, _color_property_set, ["redMultiplier"]); + Tweener.registerSpecialProperty("_color_redOffset", _color_property_get, _color_property_set, ["redOffset"]); + Tweener.registerSpecialProperty("_color_greenMultiplier", _color_property_get, _color_property_set, ["greenMultiplier"]); + Tweener.registerSpecialProperty("_color_greenOffset", _color_property_get, _color_property_set, ["greenOffset"]); + Tweener.registerSpecialProperty("_color_blueMultiplier", _color_property_get, _color_property_set, ["blueMultiplier"]); + Tweener.registerSpecialProperty("_color_blueOffset", _color_property_get, _color_property_set, ["blueOffset"]); + Tweener.registerSpecialProperty("_color_alphaMultiplier", _color_property_get, _color_property_set, ["alphaMultiplier"]); + Tweener.registerSpecialProperty("_color_alphaOffset", _color_property_get, _color_property_set, ["alphaOffset"]); + + // Normal splitter properties + Tweener.registerSpecialPropertySplitter("_color", _color_splitter); + Tweener.registerSpecialPropertySplitter("_colorTransform", _colorTransform_splitter); + + // Color changes that depend on the ColorMatrixFilter + Tweener.registerSpecialProperty("_brightness", _brightness_get, _brightness_set, [false]); + Tweener.registerSpecialProperty("_tintBrightness", _brightness_get, _brightness_set, [true]); + Tweener.registerSpecialProperty("_contrast", _contrast_get, _contrast_set); + Tweener.registerSpecialProperty("_hue", _hue_get, _hue_set); + Tweener.registerSpecialProperty("_saturation", _saturation_get, _saturation_set, [false]); + Tweener.registerSpecialProperty("_dumbSaturation", _saturation_get, _saturation_set, [true]); + + } + + + // ================================================================================================================================== + // PROPERTY GROUPING/SPLITTING functions -------------------------------------------------------------------------------------------- + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _color + + /** + * Splits the _color parameter into specific color variables + * + * @param p_value Number The original _color value + * @return Array An array containing the .name and .value of all new properties + */ + public static function _color_splitter (p_value:*, p_parameters:Array):Array { + var nArray:Array = new Array(); + if (p_value == null) { + // No parameter passed, so just resets the color + nArray.push({name:"_color_redMultiplier", value:1}); + nArray.push({name:"_color_redOffset", value:0}); + nArray.push({name:"_color_greenMultiplier", value:1}); + nArray.push({name:"_color_greenOffset", value:0}); + nArray.push({name:"_color_blueMultiplier", value:1}); + nArray.push({name:"_color_blueOffset", value:0}); + } else { + // A color tinting is passed, so converts it to the object values + nArray.push({name:"_color_redMultiplier", value:0}); + nArray.push({name:"_color_redOffset", value:AuxFunctions.numberToR(p_value)}); + nArray.push({name:"_color_greenMultiplier", value:0}); + nArray.push({name:"_color_greenOffset", value:AuxFunctions.numberToG(p_value)}); + nArray.push({name:"_color_blueMultiplier", value:0}); + nArray.push({name:"_color_blueOffset", value:AuxFunctions.numberToB(p_value)}); + } + return nArray; + } + + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _colorTransform + + /** + * Splits the _colorTransform parameter into specific color variables + * + * @param p_value Number The original _colorTransform value + * @return Array An array containing the .name and .value of all new properties + */ + public static function _colorTransform_splitter (p_value:Object, p_parameters:Array):Array { + var nArray:Array = new Array(); + if (p_value == null) { + // No parameter passed, so just resets the color + nArray.push({name:"_color_redMultiplier", value:1}); + nArray.push({name:"_color_redOffset", value:0}); + nArray.push({name:"_color_greenMultiplier", value:1}); + nArray.push({name:"_color_greenOffset", value:0}); + nArray.push({name:"_color_blueMultiplier", value:1}); + nArray.push({name:"_color_blueOffset", value:0}); + } else { + // A color tinting is passed, so converts it to the object values + if (p_value.ra != undefined) nArray.push({name:"_color_ra", value:p_value.ra}); + if (p_value.rb != undefined) nArray.push({name:"_color_rb", value:p_value.rb}); + if (p_value.ga != undefined) nArray.push({name:"_color_ba", value:p_value.ba}); + if (p_value.gb != undefined) nArray.push({name:"_color_bb", value:p_value.bb}); + if (p_value.ba != undefined) nArray.push({name:"_color_ga", value:p_value.ga}); + if (p_value.bb != undefined) nArray.push({name:"_color_gb", value:p_value.gb}); + if (p_value.aa != undefined) nArray.push({name:"_color_aa", value:p_value.aa}); + if (p_value.ab != undefined) nArray.push({name:"_color_ab", value:p_value.ab}); + if (p_value.redMultiplier != undefined) nArray.push({name:"_color_redMultiplier", value:p_value.redMultiplier}); + if (p_value.redOffset != undefined) nArray.push({name:"_color_redOffset", value:p_value.redOffset}); + if (p_value.blueMultiplier != undefined) nArray.push({name:"_color_blueMultiplier", value:p_value.blueMultiplier}); + if (p_value.blueOffset != undefined) nArray.push({name:"_color_blueOffset", value:p_value.blueOffset}); + if (p_value.greenMultiplier != undefined) nArray.push({name:"_color_greenMultiplier", value:p_value.greenMultiplier}); + if (p_value.greenOffset != undefined) nArray.push({name:"_color_greenOffset", value:p_value.greenOffset}); + if (p_value.alphaMultiplier != undefined) nArray.push({name:"_color_alphaMultiplier", value:p_value.alphaMultiplier}); + if (p_value.alphaOffset != undefined) nArray.push({name:"_color_alphaOffset", value:p_value.alphaOffset}); + } + return nArray; + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _color_* + + /** + * _color_* + * Generic function for the ra/rb/etc components of the deprecated colorTransform object + */ + public static function _oldColor_property_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.transform.colorTransform[p_parameters[0]] * 100; + } + public static function _oldColor_property_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + var tf:ColorTransform = p_obj.transform.colorTransform; + tf[p_parameters[0]] = p_value / 100; + p_obj.transform.colorTransform = tf; + } + + /** + * _color_* + * Generic function for the redMultiplier/redOffset/etc components of the new colorTransform + */ + public static function _color_property_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.transform.colorTransform[p_parameters[0]]; + } + public static function _color_property_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + var cfm:ColorTransform = p_obj.transform.colorTransform; + cfm[p_parameters[0]] = p_value; + p_obj.transform.colorTransform = cfm; + } + + // ---------------------------------------------------------------------------------------------------------------------------------- + // Special coloring + + /** + * _brightness + * Brightness of an object: -1 -> [0] -> +1 + */ + public static function _brightness_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + + var isTint:Boolean = p_parameters[0]; + + /* + // Using ColorMatrix: + + var mtx:Array = getObjectMatrix(p_obj); + + var mc:Number = 1 - ((mtx[0] + mtx[6] + mtx[12]) / 3); // Brightness as determined by the main channels + var co:Number = (mtx[4] + mtx[9] + mtx[14]) / 3; // Brightness as determined by the offset channels + */ + + var cfm:ColorTransform = p_obj.transform.colorTransform; + var mc:Number = 1 - ((cfm.redMultiplier + cfm.greenMultiplier + cfm.blueMultiplier) / 3); // Brightness as determined by the main channels + var co:Number = (cfm.redOffset + cfm.greenOffset + cfm.blueOffset) / 3; + + if (isTint) { + // Tint style + //return (mc+(co/255))/2; + return co > 0 ? co / 255 : -mc; + } else { + // Native, Flash "Adjust Color" and Photoshop style + return co / 100; + } + } + public static function _brightness_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + //var mtx:Array = getObjectMatrix(p_obj); + + var isTint:Boolean = p_parameters[0]; + + var mc:Number; // Main channel + var co:Number; // Channel offset + + if (isTint) { + // Tint style + mc = 1 - Math.abs(p_value); + co = p_value > 0 ? Math.round(p_value*255) : 0; + } else { + // Native, Flash "Adjust Color" and Photoshop style + mc = 1; + co = Math.round(p_value*100); + } + + /* + // Using ColorMatrix: + var mtx:Array = [ + mc, cc, cc, cc, co, + cc, mc, cc, cc, co, + cc, cc, mc, cc, co, + 0, 0, 0, 1, 0 + ]; + setObjectMatrix(p_obj, mtx); + */ + var cfm:ColorTransform = new ColorTransform(mc, mc, mc, 1, co, co, co, 0); + p_obj.transform.colorTransform = cfm; + } + + /** + * _saturation + * Saturation of an object: 0 -> [1] -> 2 + */ + public static function _saturation_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + + var mtx:Array = getObjectMatrix(p_obj); + + var isDumb:Boolean = p_parameters[0]; + var rl:Number = isDumb ? 1/3 : LUMINANCE_R; + var gl:Number = isDumb ? 1/3 : LUMINANCE_G; + var bl:Number = isDumb ? 1/3 : LUMINANCE_B; + + var mc:Number = ((mtx[0]-rl)/(1-rl) + (mtx[6]-gl)/(1-gl) + (mtx[12]-bl)/(1-bl)) / 3; // Color saturation as determined by the main channels + var cc:Number = 1 - ((mtx[1]/gl + mtx[2]/bl + mtx[5]/rl + mtx[7]/bl + mtx[10]/rl + mtx[11]/gl) / 6); // Color saturation as determined by the other channels + return (mc + cc) / 2; + } + public static function _saturation_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + + var isDumb:Boolean = p_parameters[0]; + var rl:Number = isDumb ? 1/3 : LUMINANCE_R; + var gl:Number = isDumb ? 1/3 : LUMINANCE_G; + var bl:Number = isDumb ? 1/3 : LUMINANCE_B; + + var sf:Number = p_value; + var nf:Number = 1-sf; + var nr:Number = rl * nf; + var ng:Number = gl * nf; + var nb:Number = bl * nf; + + var mtx:Array = [ + nr+sf, ng, nb, 0, 0, + nr, ng+sf, nb, 0, 0, + nr, ng, nb+sf, 0, 0, + 0, 0, 0, 1, 0 + ]; + setObjectMatrix(p_obj, mtx); + } + + /** + * _contrast + * Contrast of an object: -1 -> [0] -> +1 + */ + public static function _contrast_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + + /* + // Using ColorMatrix: + var mtx:Array = getObjectMatrix(p_obj); + + var mc:Number = ((mtx[0] + mtx[6] + mtx[12]) / 3) - 1; // Contrast as determined by the main channels + var co:Number = (mtx[4] + mtx[9] + mtx[14]) / 3 / -128; // Contrast as determined by the offset channel + */ + var cfm:ColorTransform = p_obj.transform.colorTransform; + var mc:Number; // Contrast as determined by the main channels + var co:Number; // Contrast as determined by the offset channel + mc = ((cfm.redMultiplier + cfm.greenMultiplier + cfm.blueMultiplier) / 3) - 1; + co = (cfm.redOffset + cfm.greenOffset + cfm.blueOffset) / 3 / -128; + /* + if (cfm.ra < 100) { + // Low contrast + mc = ((cfm.ra + cfm.ga + cfm.ba) / 300) - 1; + co = (cfm.rb + cfm.gb + cfm.bb) / 3 / -128; + } else { + // High contrast + mc = (((cfm.ra + cfm.ga + cfm.ba) / 300) - 1) / 37; + co = (cfm.rb + cfm.gb + cfm.bb) / 3 / -3840; + } + */ + + return (mc+co)/2; + } + public static function _contrast_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + + var mc:Number; // Main channel + var co:Number; // Channel offset + mc = p_value + 1; + co = Math.round(p_value*-128); + + /* + if (p_value < 0) { + // Low contrast + mc = p_value + 1; + co = Math.round(p_value*-128); + } else { + // High contrast + mc = (p_value * 37) + 1; + co = Math.round(p_value*-3840); + } + */ + + // Flash: * 8, * -512 + + /* + // Using ColorMatrix: + var mtx:Array = [ + mc, 0, 0, 0, co, + 0, mc, 0, 0, co, + 0, 0, mc, 0, co, + 0, 0, 0, 1, 0 + ]; + setObjectMatrix(p_obj, mtx); + */ + var cfm:ColorTransform = new ColorTransform(mc, mc, mc, 1, co, co, co, 0); + p_obj.transform.colorTransform = cfm; + } + + /** + * _hue + * Hue of an object: -180 -> [0] -> 180 + */ + public static function _hue_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + + var mtx:Array = getObjectMatrix(p_obj); + + // Find the current Hue based on a given matrix. + // This is a kind of a brute force method by sucessive division until a close enough angle is found. + // Reverse-engineering the hue equation would be is a better choice, but it's hard to find material + // on the correct calculation employed by Flash. + // This code has to run only once (before the tween starts), so it's good enough. + + var hues:Array = []; + var i:Number; + + hues[0] = {angle:-179.9, matrix:getHueMatrix(-179.9)}; + hues[1] = {angle:180, matrix:getHueMatrix(180)}; + + for (i = 0; i < hues.length; i++) { + hues[i].distance = getHueDistance(mtx, hues[i].matrix); + } + + var maxTries:Number = 15; // Number o maximum divisions until the hue is found + var angleToSplit:Number; + + for (i = 0; i < maxTries; i++) { + // Find the nearest angle + if (hues[0].distance < hues[1].distance) { + // First is closer + angleToSplit = 1; + } else { + // Second is closer + angleToSplit = 0; + } + hues[angleToSplit].angle = (hues[0].angle + hues[1].angle)/2; + hues[angleToSplit].matrix = getHueMatrix(hues[angleToSplit].angle) + hues[angleToSplit].distance = getHueDistance(mtx, hues[angleToSplit].matrix); + } + + return hues[angleToSplit].angle; + } + + public static function _hue_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + setObjectMatrix(p_obj, getHueMatrix(p_value)); + } + + public static function getHueDistance (mtx1:Array, mtx2:Array): Number { + return (Math.abs(mtx1[0] - mtx2[0]) + Math.abs(mtx1[1] - mtx2[1]) + Math.abs(mtx1[2] - mtx2[2])); + } + + public static function getHueMatrix (hue:Number): Array { + var ha:Number = hue * Math.PI/180; // Hue angle, to radians + + var rl:Number = LUMINANCE_R; + var gl:Number = LUMINANCE_G; + var bl:Number = LUMINANCE_B; + + var c:Number = Math.cos(ha); + var s:Number = Math.sin(ha); + + var mtx:Array = [ + (rl + (c * (1 - rl))) + (s * (-rl)), + (gl + (c * (-gl))) + (s * (-gl)), + (bl + (c * (-bl))) + (s * (1 - bl)), + 0, 0, + + (rl + (c * (-rl))) + (s * 0.143), + (gl + (c * (1 - gl))) + (s * 0.14), + (bl + (c * (-bl))) + (s * -0.283), + 0, 0, + + (rl + (c * (-rl))) + (s * (-(1 - rl))), + (gl + (c * (-gl))) + (s * gl), + (bl + (c * (1 - bl))) + (s * bl), + 0, 0, + + 0, 0, 0, 1, 0 + ]; + + return mtx; + } + + + // ================================================================================================================================== + // AUXILIARY functions -------------------------------------------------------------------------------------------------------------- + + private static function getObjectMatrix(p_obj:Object): Array { + // Get the current color matrix of an object + for (var i:Number = 0; i < p_obj.filters.length; i++) { + if (p_obj.filters[i] is ColorMatrixFilter) { + return p_obj.filters[i].matrix.concat(); + } + } + return [ + 1, 0, 0, 0, 0, + 0, 1, 0, 0, 0, + 0, 0, 1, 0, 0, + 0, 0, 0, 1, 0 + ]; + } + + private static function setObjectMatrix(p_obj:Object, p_matrix:Array): void { + // Set the current color matrix of an object + var objFilters:Array = p_obj.filters.concat(); + var found:Boolean = false; + for (var i:Number = 0; i < objFilters.length; i++) { + if (objFilters[i] is ColorMatrixFilter) { + objFilters[i].matrix = p_matrix.concat(); + found = true; + } + } + if (!found) { + // Has to create a new color matrix filter + var cmtx:ColorMatrixFilter = new ColorMatrixFilter(p_matrix); + objFilters[objFilters.length] = cmtx; + } + p_obj.filters = objFilters; + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/CurveModifiers.as b/flash/ImageDisplayx1/caurina/transitions/properties/CurveModifiers.as new file mode 100644 index 0000000000..b004c1fcc0 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/CurveModifiers.as @@ -0,0 +1,109 @@ +package caurina.transitions.properties { + + /** + * properties.CurveModifiers + * List of default special properties modifiers for the Tweener class + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import caurina.transitions.Tweener; + + public class CurveModifiers { + + /** + * There's no constructor. + */ + public function CurveModifiers () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init(): void { + + // Bezier modifiers + Tweener.registerSpecialPropertyModifier("_bezier", _bezier_modifier, _bezier_get); + } + + + // ================================================================================================================================== + // SPECIAL PROPERTY MODIFIER functions ---------------------------------------------------------------------------------------------- + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _bezier + + /** + * Given the parameter object passed to this special property, return an array listing the properties that should be modified, and their parameters + * + * @param p_obj Object Parameter passed to this property + * @return Array Array listing name and parameter of each property + */ + public static function _bezier_modifier (p_obj:*):Array { + var mList:Array = []; // List of properties to be modified + var pList:Array; // List of parameters passed, normalized as an array + if (p_obj is Array) { + // Complex + pList = p_obj; + } else { + pList = [p_obj]; + } + + var i:uint; + var istr:String; + var mListObj:Object = {}; // Object describing each property name and parameter + + for (i = 0; i < pList.length; i++) { + for (istr in pList[i]) { + if (mListObj[istr] == undefined) mListObj[istr] = []; + mListObj[istr].push(pList[i][istr]); + } + } + for (istr in mListObj) { + mList.push({name:istr, parameters:mListObj[istr]}); + } + return mList; + } + + /** + * Given tweening specifications (beging, end, t), applies the property parameter to it, returning new t + * + * @param b Number Beginning value of the property + * @param e Number Ending (desired) value of the property + * @param t Number Current t of this tweening (0-1), after applying the easing equation + * @param p Array Array of parameters passed to this specific property + * @return Number New t, with the p parameters applied to it + */ + public static function _bezier_get (b:Number, e:Number, t:Number, p:Array):Number { + // This is based on Robert Penner's code + if (p.length == 1) { + // Simple curve with just one bezier control point + return b + t*(2*(1-t)*(p[0]-b) + t*(e - b)); + } else { + // Array of bezier control points, must find the point between each pair of bezier points + var ip:uint = Math.floor(t * p.length); // Position on the bezier list + var it:Number = (t - (ip * (1 / p.length))) * p.length; // t inside this ip + var p1:Number, p2:Number; + if (ip == 0) { + // First part: belongs to the first control point, find second midpoint + p1 = b; + p2 = (p[0]+p[1])/2; + } else if (ip == p.length - 1) { + // Last part: belongs to the last control point, find first midpoint + p1 = (p[ip-1]+p[ip])/2; + p2 = e; + } else { + // Any middle part: find both midpoints + p1 = (p[ip-1]+p[ip])/2; + p2 = (p[ip]+p[ip+1])/2; + } + return p1+it*(2*(1-it)*(p[ip]-p1) + it*(p2 - p1)); + } + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/DisplayShortcuts.as b/flash/ImageDisplayx1/caurina/transitions/properties/DisplayShortcuts.as new file mode 100644 index 0000000000..fff4568ab2 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/DisplayShortcuts.as @@ -0,0 +1,161 @@ +package caurina.transitions.properties { + + /** + * properties.DisplayShortcuts.as + * List of default special MovieClip properties (normal and splitter properties) for the Tweener class + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import flash.geom.Point; + import flash.geom.Rectangle; + + import caurina.transitions.Tweener; + + public class DisplayShortcuts { + + /** + * There's no constructor. + */ + public function DisplayShortcuts () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init(): void { + + // Normal properties + Tweener.registerSpecialProperty("_frame", _frame_get, _frame_set); + Tweener.registerSpecialProperty("_autoAlpha", _autoAlpha_get, _autoAlpha_set); + + // Scale splitter properties + Tweener.registerSpecialPropertySplitter("_scale", _scale_splitter); + + // scrollRect splitter properties + Tweener.registerSpecialPropertySplitter("_scrollRect", _scrollRect_splitter); + + // scrollrect normal properties + Tweener.registerSpecialProperty("_scrollRect_x", _scrollRect_property_get, _scrollRect_property_set, ["x"]); + Tweener.registerSpecialProperty("_scrollRect_y", _scrollRect_property_get, _scrollRect_property_set, ["y"]); + Tweener.registerSpecialProperty("_scrollRect_left", _scrollRect_property_get, _scrollRect_property_set, ["left"]); + Tweener.registerSpecialProperty("_scrollRect_right", _scrollRect_property_get, _scrollRect_property_set, ["right"]); + Tweener.registerSpecialProperty("_scrollRect_top", _scrollRect_property_get, _scrollRect_property_set, ["top"]); + Tweener.registerSpecialProperty("_scrollRect_bottom", _scrollRect_property_get, _scrollRect_property_set, ["bottom"]); + Tweener.registerSpecialProperty("_scrollRect_width", _scrollRect_property_get, _scrollRect_property_set, ["width"]); + Tweener.registerSpecialProperty("_scrollRect_height", _scrollRect_property_get, _scrollRect_property_set, ["height"]); + + } + + + // ================================================================================================================================== + // PROPERTY GROUPING/SPLITTING functions -------------------------------------------------------------------------------------------- + + // ---------------------------------------------------------------------------------------------------------------------------------- + // scale + public static function _scale_splitter(p_value:Number, p_parameters:Array) : Array{ + var nArray:Array = new Array(); + nArray.push({name:"scaleX", value: p_value}); + nArray.push({name:"scaleY", value: p_value}); + return nArray; + } + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _scrollRect + + /** + * Splits the _scrollRect parameter into specific scrollRect variables + * + * @param p_value Rectangle The original _scrollRect rectangle + * @return Array An array containing the .name and .value of all new properties + */ + public static function _scrollRect_splitter (p_value:Rectangle, p_parameters:Array, p_extra:Object = null):Array { + var nArray:Array = new Array(); + if (p_value == null) { + // No parameter passed, so try any rectangle :/ + nArray.push({name:"_scrollRect_x", value:0}); + nArray.push({name:"_scrollRect_y", value:0}); + nArray.push({name:"_scrollRect_width", value:100}); + nArray.push({name:"_scrollRect_height", value:100}); + } else { + // A rectangle is passed, so just return the properties + nArray.push({name:"_scrollRect_x", value:p_value.x}); + nArray.push({name:"_scrollRect_y", value:p_value.y}); + nArray.push({name:"_scrollRect_width", value:p_value.width}); + nArray.push({name:"_scrollRect_height", value:p_value.height}); + } + return nArray; + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _frame + + /** + * Returns the current frame number from the movieclip timeline + * + * @param p_obj Object MovieClip object + * @return Number The current frame + */ + public static function _frame_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.currentFrame; + } + + /** + * Sets the timeline frame + * + * @param p_obj Object MovieClip object + * @param p_value Number New frame number + */ + public static function _frame_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + p_obj.gotoAndStop(Math.round(p_value)); + } + + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _autoAlpha + + /** + * Returns the current alpha + * + * @param p_obj Object MovieClip or Textfield object + * @return Number The current alpha + */ + public static function _autoAlpha_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.alpha; + } + + /** + * Sets the current autoAlpha + * + * @param p_obj Object MovieClip or Textfield object + * @param p_value Number New alpha + */ + public static function _autoAlpha_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + p_obj.alpha = p_value; + p_obj.visible = p_value > 0; + } + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _scrollRect_* + + /** + * _scrollRect_* + * Generic function for the properties of the scrollRect object + */ + public static function _scrollRect_property_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.scrollRect[p_parameters[0]]; + } + public static function _scrollRect_property_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + var rect:Rectangle = p_obj.scrollRect; + rect[p_parameters[0]] = Math.round(p_value); + p_obj.scrollRect = rect; + } + } +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/FilterShortcuts.as b/flash/ImageDisplayx1/caurina/transitions/properties/FilterShortcuts.as new file mode 100644 index 0000000000..e63b7e18cf --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/FilterShortcuts.as @@ -0,0 +1,495 @@ +package caurina.transitions.properties { + + /** + * properties.FilterShortcuts + * Special properties for the Tweener class to handle MovieClip filters + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import flash.display.BitmapData; + import flash.filters.BevelFilter; + import flash.filters.BitmapFilter; + import flash.filters.BlurFilter; + import flash.filters.ColorMatrixFilter; + import flash.filters.ConvolutionFilter; + import flash.filters.DisplacementMapFilter; + import flash.filters.DropShadowFilter; + import flash.filters.GlowFilter; + import flash.filters.GradientBevelFilter; + import flash.filters.GradientGlowFilter; + import flash.geom.Point; + + import caurina.transitions.Tweener; + import caurina.transitions.AuxFunctions; + + public class FilterShortcuts { + + /** + * There's no constructor. + */ + public function FilterShortcuts () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init(): void { + + // Filter tweening splitter properties + Tweener.registerSpecialPropertySplitter("_filter", _filter_splitter); + + // Shortcuts - BevelFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/BevelFilter.html + Tweener.registerSpecialProperty("_Bevel_angle", _filter_property_get, _filter_property_set, [BevelFilter, "angle"]); + Tweener.registerSpecialProperty("_Bevel_blurX", _filter_property_get, _filter_property_set, [BevelFilter, "blurX"]); + Tweener.registerSpecialProperty("_Bevel_blurY", _filter_property_get, _filter_property_set, [BevelFilter, "blurY"]); + Tweener.registerSpecialProperty("_Bevel_distance", _filter_property_get, _filter_property_set, [BevelFilter, "distance"]); + Tweener.registerSpecialProperty("_Bevel_highlightAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "highlightAlpha"]); + Tweener.registerSpecialPropertySplitter("_Bevel_highlightColor", _generic_color_splitter, ["_Bevel_highlightColor_r", "_Bevel_highlightColor_g", "_Bevel_highlightColor_b"]); + Tweener.registerSpecialProperty("_Bevel_highlightColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "r"]); + Tweener.registerSpecialProperty("_Bevel_highlightColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "g"]); + Tweener.registerSpecialProperty("_Bevel_highlightColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "highlightColor", "color", "b"]); + Tweener.registerSpecialProperty("_Bevel_knockout", _filter_property_get, _filter_property_set, [BevelFilter, "knockout"]); + Tweener.registerSpecialProperty("_Bevel_quality", _filter_property_get, _filter_property_set, [BevelFilter, "quality"]); + Tweener.registerSpecialProperty("_Bevel_shadowAlpha", _filter_property_get, _filter_property_set, [BevelFilter, "shadowAlpha"]); + Tweener.registerSpecialPropertySplitter("_Bevel_shadowColor", _generic_color_splitter, ["_Bevel_shadowColor_r", "_Bevel_shadowColor_g", "_Bevel_shadowColor_b"]); + Tweener.registerSpecialProperty("_Bevel_shadowColor_r", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "r"]); + Tweener.registerSpecialProperty("_Bevel_shadowColor_g", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "g"]); + Tweener.registerSpecialProperty("_Bevel_shadowColor_b", _filter_property_get, _filter_property_set, [BevelFilter, "shadowColor", "color", "b"]); + Tweener.registerSpecialProperty("_Bevel_strength", _filter_property_get, _filter_property_set, [BevelFilter, "strength"]); + Tweener.registerSpecialProperty("_Bevel_type", _filter_property_get, _filter_property_set, [BevelFilter, "type"]); + + // Shortcuts - BlurFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/BlurFilter.html + Tweener.registerSpecialProperty("_Blur_blurX", _filter_property_get, _filter_property_set, [BlurFilter, "blurX"]); + Tweener.registerSpecialProperty("_Blur_blurY", _filter_property_get, _filter_property_set, [BlurFilter, "blurY"]); + Tweener.registerSpecialProperty("_Blur_quality", _filter_property_get, _filter_property_set, [BlurFilter, "quality"]); + + // Shortcuts - ColorMatrixFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/ColorMatrixFilter.html + Tweener.registerSpecialPropertySplitter("_ColorMatrix_matrix", _generic_matrix_splitter, [[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], + ["_ColorMatrix_matrix_rr", "_ColorMatrix_matrix_rg", "_ColorMatrix_matrix_rb", "_ColorMatrix_matrix_ra", "_ColorMatrix_matrix_ro", + "_ColorMatrix_matrix_gr", "_ColorMatrix_matrix_gg", "_ColorMatrix_matrix_gb", "_ColorMatrix_matrix_ga", "_ColorMatrix_matrix_go", + "_ColorMatrix_matrix_br", "_ColorMatrix_matrix_bg", "_ColorMatrix_matrix_bb", "_ColorMatrix_matrix_ba", "_ColorMatrix_matrix_bo", + "_ColorMatrix_matrix_ar", "_ColorMatrix_matrix_ag", "_ColorMatrix_matrix_ab", "_ColorMatrix_matrix_aa", "_ColorMatrix_matrix_ao"]]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_rr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 0]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_rg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 1]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_rb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 2]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ra", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 3]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ro", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 4]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_gr", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 5]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_gg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 6]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_gb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 7]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ga", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 8]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_go", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 9]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_br", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 10]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_bg", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 11]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_bb", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 12]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ba", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 13]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_bo", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 14]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ar", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 15]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ag", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 16]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ab", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 17]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_aa", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 18]); + Tweener.registerSpecialProperty("_ColorMatrix_matrix_ao", _filter_property_get, _filter_property_set, [ColorMatrixFilter, "matrix", "matrix", 19]); + + // Shortcuts - ConvolutionFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/ConvolutionFilter.html + Tweener.registerSpecialProperty("_Convolution_alpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "alpha"]); + Tweener.registerSpecialProperty("_Convolution_bias", _filter_property_get, _filter_property_set, [ConvolutionFilter, "bias"]); + Tweener.registerSpecialProperty("_Convolution_clamp", _filter_property_get, _filter_property_set, [ConvolutionFilter, "clamp"]); + Tweener.registerSpecialPropertySplitter("_Convolution_color", _generic_color_splitter, ["_Convolution_color_r", "_Convolution_color_g", "_Convolution_color_b"]); + Tweener.registerSpecialProperty("_Convolution_color_r", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "r"]); + Tweener.registerSpecialProperty("_Convolution_color_g", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "g"]); + Tweener.registerSpecialProperty("_Convolution_color_b", _filter_property_get, _filter_property_set, [ConvolutionFilter, "color", "color", "b"]); + Tweener.registerSpecialProperty("_Convolution_divisor", _filter_property_get, _filter_property_set, [ConvolutionFilter, "divisor"]); + //Tweener.registerSpecialPropertySplitter("_Convolution_matrix", _generic_array_splitter, ["_Convolution_matrix_array"]); + //Tweener.registerSpecialProperty("_Convolution_matrix_array", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrix", "array"]); + Tweener.registerSpecialProperty("_Convolution_matrixX", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixX"]); + Tweener.registerSpecialProperty("_Convolution_matrixY", _filter_property_get, _filter_property_set, [ConvolutionFilter, "matrixY"]); + Tweener.registerSpecialProperty("_Convolution_preserveAlpha", _filter_property_get, _filter_property_set, [ConvolutionFilter, "preserveAlpha"]); + + // Shortcuts - DisplacementMapFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/DisplacementMapFilter.html + Tweener.registerSpecialProperty("_DisplacementMap_alpha", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "alpha"]); + Tweener.registerSpecialPropertySplitter("_DisplacementMap_color", _generic_color_splitter, ["_DisplacementMap_color_r", "_DisplacementMap_color_r", "_DisplacementMap_color_r"]); + Tweener.registerSpecialProperty("_DisplacementMap_color_r", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "r"]); + Tweener.registerSpecialProperty("_DisplacementMap_color_g", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "g"]); + Tweener.registerSpecialProperty("_DisplacementMap_color_b", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "color", "color", "b"]); + Tweener.registerSpecialProperty("_DisplacementMap_componentX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentX"]); + Tweener.registerSpecialProperty("_DisplacementMap_componentY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "componentY"]); + Tweener.registerSpecialProperty("_DisplacementMap_mapBitmap", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapBitmap"]); + Tweener.registerSpecialProperty("_DisplacementMap_mapPoint", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mapPoint"]); + Tweener.registerSpecialProperty("_DisplacementMap_mode", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "mode"]); + Tweener.registerSpecialProperty("_DisplacementMap_scaleX", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleX"]); + Tweener.registerSpecialProperty("_DisplacementMap_scaleY", _filter_property_get, _filter_property_set, [DisplacementMapFilter, "scaleY"]); + + // Shortcuts - DropShadowFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/DropShadowFilter.html + Tweener.registerSpecialProperty("_DropShadow_alpha", _filter_property_get, _filter_property_set, [DropShadowFilter, "alpha"]); + Tweener.registerSpecialProperty("_DropShadow_angle", _filter_property_get, _filter_property_set, [DropShadowFilter, "angle"]); + Tweener.registerSpecialProperty("_DropShadow_blurX", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurX"]); + Tweener.registerSpecialProperty("_DropShadow_blurY", _filter_property_get, _filter_property_set, [DropShadowFilter, "blurY"]); + Tweener.registerSpecialPropertySplitter("_DropShadow_color", _generic_color_splitter, ["_DropShadow_color_r", "_DropShadow_color_g", "_DropShadow_color_b"]); + Tweener.registerSpecialProperty("_DropShadow_color_r", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "r"]); + Tweener.registerSpecialProperty("_DropShadow_color_g", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "g"]); + Tweener.registerSpecialProperty("_DropShadow_color_b", _filter_property_get, _filter_property_set, [DropShadowFilter, "color", "color", "b"]); + Tweener.registerSpecialProperty("_DropShadow_distance", _filter_property_get, _filter_property_set, [DropShadowFilter, "distance"]); + Tweener.registerSpecialProperty("_DropShadow_hideObject", _filter_property_get, _filter_property_set, [DropShadowFilter, "hideObject"]); + Tweener.registerSpecialProperty("_DropShadow_inner", _filter_property_get, _filter_property_set, [DropShadowFilter, "inner"]); + Tweener.registerSpecialProperty("_DropShadow_knockout", _filter_property_get, _filter_property_set, [DropShadowFilter, "knockout"]); + Tweener.registerSpecialProperty("_DropShadow_quality", _filter_property_get, _filter_property_set, [DropShadowFilter, "quality"]); + Tweener.registerSpecialProperty("_DropShadow_strength", _filter_property_get, _filter_property_set, [DropShadowFilter, "strength"]); + + // Shortcuts - GlowFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/GlowFilter.html + Tweener.registerSpecialProperty("_Glow_alpha", _filter_property_get, _filter_property_set, [GlowFilter, "alpha"]); + Tweener.registerSpecialProperty("_Glow_blurX", _filter_property_get, _filter_property_set, [GlowFilter, "blurX"]); + Tweener.registerSpecialProperty("_Glow_blurY", _filter_property_get, _filter_property_set, [GlowFilter, "blurY"]); + Tweener.registerSpecialPropertySplitter("_Glow_color", _generic_color_splitter, ["_Glow_color_r", "_Glow_color_g", "_Glow_color_b"]); + Tweener.registerSpecialProperty("_Glow_color_r", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "r"]); + Tweener.registerSpecialProperty("_Glow_color_g", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "g"]); + Tweener.registerSpecialProperty("_Glow_color_b", _filter_property_get, _filter_property_set, [GlowFilter, "color", "color", "b"]); + Tweener.registerSpecialProperty("_Glow_inner", _filter_property_get, _filter_property_set, [GlowFilter, "inner"]); + Tweener.registerSpecialProperty("_Glow_knockout", _filter_property_get, _filter_property_set, [GlowFilter, "knockout"]); + Tweener.registerSpecialProperty("_Glow_quality", _filter_property_get, _filter_property_set, [GlowFilter, "quality"]); + Tweener.registerSpecialProperty("_Glow_strength", _filter_property_get, _filter_property_set, [GlowFilter, "strength"]); + + // Shortcuts - GradientBevelFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/GradientBevelFilter.html + // .alphas (array) + Tweener.registerSpecialProperty("_GradientBevel_angle", _filter_property_get, _filter_property_set, [GradientBevelFilter, "angle"]); + Tweener.registerSpecialProperty("_GradientBevel_blurX", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurX"]); + Tweener.registerSpecialProperty("_GradientBevel_blurY", _filter_property_get, _filter_property_set, [GradientBevelFilter, "blurY"]); + // .colors (array) + Tweener.registerSpecialProperty("_GradientBevel_distance", _filter_property_get, _filter_property_set, [GradientBevelFilter, "distance"]); + Tweener.registerSpecialProperty("_GradientBevel_quality", _filter_property_get, _filter_property_set, [GradientBevelFilter, "quality"]); + // .ratios(array) + Tweener.registerSpecialProperty("_GradientBevel_strength", _filter_property_get, _filter_property_set, [GradientBevelFilter, "strength"]); + Tweener.registerSpecialProperty("_GradientBevel_type", _filter_property_get, _filter_property_set, [GradientBevelFilter, "type"]); + + // Shortcuts - GradientGlowFilter + // http://livedocs.adobe.com/flex/2/langref/flash/filters/GradientGlowFilter.html + // .alphas (array) + Tweener.registerSpecialProperty("_GradientGlow_angle", _filter_property_get, _filter_property_set, [GradientGlowFilter, "angle"]); + Tweener.registerSpecialProperty("_GradientGlow_blurX", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurX"]); + Tweener.registerSpecialProperty("_GradientGlow_blurY", _filter_property_get, _filter_property_set, [GradientGlowFilter, "blurY"]); + // .colors (array) + Tweener.registerSpecialProperty("_GradientGlow_distance", _filter_property_get, _filter_property_set, [GradientGlowFilter, "distance"]); + Tweener.registerSpecialProperty("_GradientGlow_knockout", _filter_property_get, _filter_property_set, [GradientGlowFilter, "knockout"]); + Tweener.registerSpecialProperty("_GradientGlow_quality", _filter_property_get, _filter_property_set, [GradientGlowFilter, "quality"]); + // .ratios (array) + Tweener.registerSpecialProperty("_GradientGlow_strength", _filter_property_get, _filter_property_set, [GradientGlowFilter, "strength"]); + Tweener.registerSpecialProperty("_GradientGlow_type", _filter_property_get, _filter_property_set, [GradientGlowFilter, "type"]); + + } + + + // ================================================================================================================================== + // PROPERTY GROUPING/SPLITTING functions -------------------------------------------------------------------------------------------- + + // ---------------------------------------------------------------------------------------------------------------------------------- + // generic splitters + + /** + * A generic color splitter - from 0xrrggbb to r, g, b with the name of the parameters passed + * + * @param p_value Number The original _color value + * @return Array An array containing the .name and .value of all new properties + */ + public static function _generic_color_splitter (p_value:Number, p_parameters:Array):Array { + var nArray:Array = new Array(); + nArray.push({name:p_parameters[0], value:AuxFunctions.numberToR(p_value)}); + nArray.push({name:p_parameters[1], value:AuxFunctions.numberToG(p_value)}); + nArray.push({name:p_parameters[2], value:AuxFunctions.numberToB(p_value)}); + return nArray; + } + + /** + * A generic matrix splitter - from [] to items with the name of the parameters passed + * + * @param p_value Array The original + * @return Array An array containing the .name and .value of all new properties + */ + public static function _generic_matrix_splitter (p_value:Array, p_parameters:Array):Array { + if (p_value == null) p_value = p_parameters[0].concat(); + var nArray:Array = new Array(); + for (var i:Number = 0; i < p_value.length; i++) { + nArray.push({name:p_parameters[1][i], value:p_value[i]}); + } + return nArray; + } + + /** + * A generic array splitter - from [] to items with the index passed back + * + * @param p_value Array The original array value + * @return Array An array containing the .name and .value of all new properties + */ + /* + public static function _generic_array_splitter (p_value:Array, p_parameters:Array):Array { + if (p_value == null) p_value = p_parameters[0].concat(); + var nArray:Array = new Array(); + for (var i:Number = 0; i < p_value.length; i++) { + nArray.push({name:p_parameters[1][i], value:p_value[i], arrayIndex:i}); + } + return nArray; + } + */ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // filters + + /** + * Splits the _filter, _blur, etc parameter into specific filter variables + * + * @param p_value BitmapFilter A BitmapFilter instance + * @return Array An array containing the .name and .value of all new properties + */ + public static function _filter_splitter (p_value:BitmapFilter, p_parameters:Array, p_extra:Object = null):Array { + var nArray:Array = new Array(); + if (p_value is BevelFilter) { + nArray.push({name:"_Bevel_angle", value:BevelFilter(p_value).angle}); + nArray.push({name:"_Bevel_blurX", value:BevelFilter(p_value).blurX}); + nArray.push({name:"_Bevel_blurY", value:BevelFilter(p_value).blurY}); + nArray.push({name:"_Bevel_distance", value:BevelFilter(p_value).distance}); + nArray.push({name:"_Bevel_highlightAlpha", value:BevelFilter(p_value).highlightAlpha}); + nArray.push({name:"_Bevel_highlightColor", value:BevelFilter(p_value).highlightColor}); + nArray.push({name:"_Bevel_knockout", value:BevelFilter(p_value).knockout}); + nArray.push({name:"_Bevel_quality", value:BevelFilter(p_value).quality}); + nArray.push({name:"_Bevel_shadowAlpha", value:BevelFilter(p_value).shadowAlpha}); + nArray.push({name:"_Bevel_shadowColor", value:BevelFilter(p_value).shadowColor}); + nArray.push({name:"_Bevel_strength", value:BevelFilter(p_value).strength}); + nArray.push({name:"_Bevel_type", value:BevelFilter(p_value).type}); + } else if (p_value is BlurFilter) { + nArray.push({name:"_Blur_blurX", value:BlurFilter(p_value).blurX}); + nArray.push({name:"_Blur_blurY", value:BlurFilter(p_value).blurY}); + nArray.push({name:"_Blur_quality", value:BlurFilter(p_value).quality}); + } else if (p_value is ColorMatrixFilter) { + nArray.push({name:"_ColorMatrix_matrix", value:ColorMatrixFilter(p_value).matrix}); + } else if (p_value is ConvolutionFilter) { + nArray.push({name:"_Convolution_alpha", value:ConvolutionFilter(p_value).alpha}); + nArray.push({name:"_Convolution_bias", value:ConvolutionFilter(p_value).bias}); + nArray.push({name:"_Convolution_clamp", value:ConvolutionFilter(p_value).clamp}); + nArray.push({name:"_Convolution_color", value:ConvolutionFilter(p_value).color}); + // .matrix + nArray.push({name:"_Convolution_divisor", value:ConvolutionFilter(p_value).divisor}); + nArray.push({name:"_Convolution_matrixX", value:ConvolutionFilter(p_value).matrixX}); + nArray.push({name:"_Convolution_matrixY", value:ConvolutionFilter(p_value).matrixY}); + nArray.push({name:"_Convolution_preserveAlpha", value:ConvolutionFilter(p_value).preserveAlpha}); + } else if (p_value is DisplacementMapFilter) { + nArray.push({name:"_DisplacementMap_alpha", value:DisplacementMapFilter(p_value).alpha}); + nArray.push({name:"_DisplacementMap_color", value:DisplacementMapFilter(p_value).color}); + nArray.push({name:"_DisplacementMap_componentX", value:DisplacementMapFilter(p_value).componentX}); + nArray.push({name:"_DisplacementMap_componentY", value:DisplacementMapFilter(p_value).componentY}); + nArray.push({name:"_DisplacementMap_mapBitmap", value:DisplacementMapFilter(p_value).mapBitmap}); + nArray.push({name:"_DisplacementMap_mapPoint", value:DisplacementMapFilter(p_value).mapPoint}); + nArray.push({name:"_DisplacementMap_mode", value:DisplacementMapFilter(p_value).mode}); + nArray.push({name:"_DisplacementMap_scaleX", value:DisplacementMapFilter(p_value).scaleX}); + nArray.push({name:"_DisplacementMap_scaleY", value:DisplacementMapFilter(p_value).scaleY}); + } else if (p_value is DropShadowFilter) { + nArray.push({name:"_DropShadow_alpha", value:DropShadowFilter(p_value).alpha}); + nArray.push({name:"_DropShadow_angle", value:DropShadowFilter(p_value).angle}); + nArray.push({name:"_DropShadow_blurX", value:DropShadowFilter(p_value).blurX}); + nArray.push({name:"_DropShadow_blurY", value:DropShadowFilter(p_value).blurY}); + nArray.push({name:"_DropShadow_color", value:DropShadowFilter(p_value).color}); + nArray.push({name:"_DropShadow_distance", value:DropShadowFilter(p_value).distance}); + nArray.push({name:"_DropShadow_hideObject", value:DropShadowFilter(p_value).hideObject}); + nArray.push({name:"_DropShadow_inner", value:DropShadowFilter(p_value).inner}); + nArray.push({name:"_DropShadow_knockout", value:DropShadowFilter(p_value).knockout}); + nArray.push({name:"_DropShadow_quality", value:DropShadowFilter(p_value).quality}); + nArray.push({name:"_DropShadow_strength", value:DropShadowFilter(p_value).strength}); + } else if (p_value is GlowFilter) { + nArray.push({name:"_Glow_alpha", value:GlowFilter(p_value).alpha}); + nArray.push({name:"_Glow_blurX", value:GlowFilter(p_value).blurX}); + nArray.push({name:"_Glow_blurY", value:GlowFilter(p_value).blurY}); + nArray.push({name:"_Glow_color", value:GlowFilter(p_value).color}); + nArray.push({name:"_Glow_inner", value:GlowFilter(p_value).inner}); + nArray.push({name:"_Glow_knockout", value:GlowFilter(p_value).knockout}); + nArray.push({name:"_Glow_quality", value:GlowFilter(p_value).quality}); + nArray.push({name:"_Glow_strength", value:GlowFilter(p_value).strength}); + } else if (p_value is GradientBevelFilter) { + // .alphas (array) + nArray.push({name:"_GradientBevel_angle", value:GradientBevelFilter(p_value).strength}); + nArray.push({name:"_GradientBevel_blurX", value:GradientBevelFilter(p_value).blurX}); + nArray.push({name:"_GradientBevel_blurY", value:GradientBevelFilter(p_value).blurY}); + // .colors (array) + nArray.push({name:"_GradientBevel_distance", value:GradientBevelFilter(p_value).distance}); + nArray.push({name:"_GradientBevel_quality", value:GradientBevelFilter(p_value).quality}); + // .ratios(array) + nArray.push({name:"_GradientBevel_strength", value:GradientBevelFilter(p_value).strength}); + nArray.push({name:"_GradientBevel_type", value:GradientBevelFilter(p_value).type}); + } else if (p_value is GradientGlowFilter) { + // .alphas (array) + nArray.push({name:"_GradientGlow_angle", value:GradientGlowFilter(p_value).strength}); + nArray.push({name:"_GradientGlow_blurX", value:GradientGlowFilter(p_value).blurX}); + nArray.push({name:"_GradientGlow_blurY", value:GradientGlowFilter(p_value).blurY}); + // .colors (array) + nArray.push({name:"_GradientGlow_distance", value:GradientGlowFilter(p_value).distance}); + nArray.push({name:"_GradientGlow_knockout", value:GradientGlowFilter(p_value).knockout}); + nArray.push({name:"_GradientGlow_quality", value:GradientGlowFilter(p_value).quality}); + // .ratios(array) + nArray.push({name:"_GradientGlow_strength", value:GradientGlowFilter(p_value).strength}); + nArray.push({name:"_GradientGlow_type", value:GradientGlowFilter(p_value).type}); + } else { + // ? + trace ("Tweener FilterShortcuts Error :: Unknown filter class used"); + } + return nArray; + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // filters + + /** + * (filters) + * Generic function for the properties of filter objects + */ + public static function _filter_property_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + var f:Array = p_obj.filters; + var i:Number; + var filterClass:Object = p_parameters[0]; + var propertyName:String = p_parameters[1]; + var splitType:String = p_parameters[2]; + for (i = 0; i < f.length; i++) { + if (f[i] is Class(filterClass)) { + if (splitType == "color") { + // Composite, color channel + var colorComponent:String = p_parameters[3]; + if (colorComponent == "r") return AuxFunctions.numberToR(f[i][propertyName]); + if (colorComponent == "g") return AuxFunctions.numberToG(f[i][propertyName]); + if (colorComponent == "b") return AuxFunctions.numberToB(f[i][propertyName]); + } else if (splitType == "matrix") { + // Composite, some kind of matrix + return f[i][propertyName][p_parameters[3]]; + } else { + // Standard property + return (f[i][propertyName]); + } + } + } + + // No value found for this property - no filter instance found using this class! + // Must return default desired values + var defaultValues:Object; + switch (filterClass) { + case BevelFilter: + defaultValues = {angle:NaN, blurX:0, blurY:0, distance:0, highlightAlpha:1, highlightColor:NaN, knockout:null, quality:NaN, shadowAlpha:1, shadowColor:NaN, strength:2, type:null}; + break; + case BlurFilter: + defaultValues = {blurX:0, blurY:0, quality:NaN}; + break; + case ColorMatrixFilter: + defaultValues = {matrix:[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]}; + break; + case ConvolutionFilter: + defaultValues = {alpha:0, bias:0, clamp:null, color:NaN, divisor:1, matrix:[1], matrixX:1, matrixY:1, preserveAlpha:null}; + break; + case DisplacementMapFilter: + defaultValues = {alpha:0, color:NaN, componentX:null, componentY:null, mapBitmap:null, mapPoint:null, mode:null, scaleX:0, scaleY:0}; + break; + case DropShadowFilter: + defaultValues = {distance:0, angle:NaN, color:NaN, alpha:1, blurX:0, blurY:0, strength:1, quality:NaN, inner:null, knockout:null, hideObject:null}; + break; + case GlowFilter: + defaultValues = {alpha:1, blurX:0, blurY:0, color:NaN, inner:null, knockout:null, quality:NaN, strength:2}; + break; + case GradientBevelFilter: + defaultValues = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null}; + break; + case GradientGlowFilter: + defaultValues = {alphas:null, angle:NaN, blurX:0, blurY:0, colors:null, distance:0, knockout:null, quality:NaN, ratios:NaN, strength:1, type:null}; + break; + } + // When returning NaN, the Tweener engine sets the starting value as being the same as the final value (if not found) + // When returning null, the Tweener engine doesn't tween it at all, just setting it to the final value + // This is DIFFERENT from the default filter applied as default on _filter_property_set because some values shouldn't be tweened + if (splitType == "color") { + // Composite, color channel; always defaults to target value + return NaN; + } else if (splitType == "matrix") { + // Composite, matrix; always defaults to target value + return defaultValues[propertyName][p_parameters[3]]; + } else { + // Standard property + return defaultValues[propertyName]; + } + } + + public static function _filter_property_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + var f:Array = p_obj.filters; + var i:Number; + var filterClass:Object = p_parameters[0]; + var propertyName:String = p_parameters[1]; + var splitType:String = p_parameters[2]; + for (i = 0; i < f.length; i++) { + if (f[i] is Class(filterClass)) { + if (splitType == "color") { + // Composite, color channel + var colorComponent:String = p_parameters[3]; + if (colorComponent == "r") f[i][propertyName] = (f[i][propertyName] & 0xffff) | (p_value << 16); + if (colorComponent == "g") f[i][propertyName] = (f[i][propertyName] & 0xff00ff) | (p_value << 8); + if (colorComponent == "b") f[i][propertyName] = (f[i][propertyName] & 0xffff00) | p_value; + } else if (splitType == "matrix") { + var mtx:Array = f[i][propertyName]; + mtx[p_parameters[3]] = p_value; + f[i][propertyName] = mtx; + } else { + // Standard property + f[i][propertyName] = p_value; + } + p_obj.filters = f; + return; + } + } + + // The correct filter class wasn't found, so create a new one that is the equivalent of the object without the filter + if (f == null) f = new Array(); + var fi:BitmapFilter; + switch (filterClass) { + case BevelFilter: + fi = new BevelFilter(0, 45, 0xffffff, 1, 0x000000, 1, 0, 0); + break; + case BlurFilter: + fi = new BlurFilter(0, 0); + break; + case ColorMatrixFilter: + fi = new ColorMatrixFilter([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]); + break; + case ConvolutionFilter: + fi = new ConvolutionFilter(1, 1, [1], 1, 0, true, true, 0x000000, 0); + break; + case DisplacementMapFilter: + // Doesn't make much sense to create a new empty DisplacementMapFilter if there's nothing to tween + fi = new DisplacementMapFilter(new BitmapData(10, 10), new Point(0, 0), 0, 1, 0, 0); + break; + case DropShadowFilter: + fi = new DropShadowFilter(0, 45, 0x000000, 1, 0, 0); + break; + case GlowFilter: + fi = new GlowFilter(0xff0000, 1, 0, 0); + break; + case GradientBevelFilter: + fi = new GradientBevelFilter(0, 45, [0xffffff, 0x000000], [1, 1], [32, 223], 0, 0); + break; + case GradientGlowFilter: + fi = new GradientGlowFilter(0, 45, [0xffffff, 0x000000], [1, 1], [32, 223], 0, 0); + break; + } + //fi[propertyName] = p_value; + f.push(fi); + p_obj.filters = f; + _filter_property_set(p_obj, p_value, p_parameters); + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/SoundShortcuts.as b/flash/ImageDisplayx1/caurina/transitions/properties/SoundShortcuts.as new file mode 100644 index 0000000000..6e8b8a70a8 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/SoundShortcuts.as @@ -0,0 +1,93 @@ +package caurina.transitions.properties { + + /** + * properties.SoundShortcuts + * List of default special properties for Sounds + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import flash.media.SoundTransform; + + import caurina.transitions.Tweener; + + public class SoundShortcuts { + + /** + * There's no constructor. + */ + public function SoundShortcuts () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init():void { + + // Normal properties + Tweener.registerSpecialProperty("_sound_volume", _sound_volume_get, _sound_volume_set); + Tweener.registerSpecialProperty("_sound_pan", _sound_pan_get, _sound_pan_set); + + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _sound_volume + + /** + * Returns the current sound volume + * + * @param p_obj Object SoundChannel object + * @return Number The current volume + */ + public static function _sound_volume_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.soundTransform.volume; + } + + /** + * Sets the sound volume + * + * @param p_obj Object SoundChannel object + * @param p_value Number New volume + */ + public static function _sound_volume_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null):void { + var sndTransform:SoundTransform = p_obj.soundTransform; + sndTransform.volume = p_value; + p_obj.soundTransform = sndTransform; + } + + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _sound_pan + + /** + * Returns the current sound pan + * + * @param p_obj Object SoundChannel object + * @return Number The current pan + */ + public static function _sound_pan_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + return p_obj.soundTransform.pan; + } + + /** + * Sets the sound volume + * + * @param p_obj Object SoundChannel object + * @param p_value Number New pan + */ + public static function _sound_pan_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null):void { + var sndTransform:SoundTransform = p_obj.soundTransform; + sndTransform.pan = p_value; + p_obj.soundTransform = sndTransform; + } + + } + +} diff --git a/flash/ImageDisplayx1/caurina/transitions/properties/TextShortcuts.as b/flash/ImageDisplayx1/caurina/transitions/properties/TextShortcuts.as new file mode 100644 index 0000000000..6d8f3f88a3 --- /dev/null +++ b/flash/ImageDisplayx1/caurina/transitions/properties/TextShortcuts.as @@ -0,0 +1,157 @@ +package caurina.transitions.properties { + + /** + * properties.TextShortcuts + * Special properties for the Tweener class to handle MovieClip filters + * The function names are strange/inverted because it makes for easier debugging (alphabetic order). They're only for internal use (on this class) anyways. + * + * @author Zeh Fernando, Nate Chatellier, Arthur Debert + * @version 1.0.0 + */ + + import caurina.transitions.Tweener; + import caurina.transitions.AuxFunctions; + + import flash.text.TextFormat; + + public class TextShortcuts { + + /** + * There's no constructor. + */ + public function TextShortcuts () { + trace ("This is an static class and should not be instantiated.") + } + + /** + * Registers all the special properties to the Tweener class, so the Tweener knows what to do with them. + */ + public static function init(): void { + // Normal properties + Tweener.registerSpecialProperty("_text", _text_get, _text_set, null, _text_preProcess); + // Tweener.registerSpecialPropertyModifier("_text", _text_modifier, _text_get); + + // TextFormat-based properties + Tweener.registerSpecialPropertySplitter("_text_color", _generic_color_splitter, ["_text_color_r", "_text_color_g", "_text_color_b"]); + Tweener.registerSpecialProperty("_text_color_r", _textFormat_property_get, _textFormat_property_set, ["color", true, "r"]); + Tweener.registerSpecialProperty("_text_color_g", _textFormat_property_get, _textFormat_property_set, ["color", true, "g"]); + Tweener.registerSpecialProperty("_text_color_b", _textFormat_property_get, _textFormat_property_set, ["color", true, "b"]); + Tweener.registerSpecialProperty("_text_indent", _textFormat_property_get, _textFormat_property_set, ["indent"]); + Tweener.registerSpecialProperty("_text_leading", _textFormat_property_get, _textFormat_property_set, ["leading"]); + Tweener.registerSpecialProperty("_text_leftMargin", _textFormat_property_get, _textFormat_property_set, ["leftMargin"]); + Tweener.registerSpecialProperty("_text_letterSpacing", _textFormat_property_get, _textFormat_property_set, ["letterSpacing"]); + Tweener.registerSpecialProperty("_text_rightMargin", _textFormat_property_get, _textFormat_property_set, ["rightMargin"]); + Tweener.registerSpecialProperty("_text_size", _textFormat_property_get, _textFormat_property_set, ["size"]); + + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + // ---------------------------------------------------------------------------------------------------------------------------------- + // _text + + /** + * Returns the current frame number from the movieclip timeline + * + * @param p_obj Object MovieClip object + * @return Number The current frame + */ + public static function _text_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + //return p_obj._currentFrame; + return -p_obj.text.length; + } + + /** + * Sets the timeline frame + * + * @param p_obj Object MovieClip object + * @param p_value Number New frame number + */ + public static function _text_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + //p_obj.gotoAndStop(Math.round(p_value)); + //p_obj.text = + if (p_value < 0) { + // Old text + p_obj.text = p_extra.oldText.substr(0, -Math.round(p_value)); + } else { + // New text + p_obj.text = p_extra.newText.substr(0, Math.round(p_value)); + } + } + + public static function _text_preProcess (p_obj:Object, p_parameters:Array, p_originalValueComplete:Object, p_extra:Object): Number { + p_extra.oldText = p_obj.text; + p_extra.newText = p_originalValueComplete; + return p_extra.newText.length; + } + + // ================================================================================================================================== + // PROPERTY GROUPING/SPLITTING functions -------------------------------------------------------------------------------------------- + + // ---------------------------------------------------------------------------------------------------------------------------------- + // generic splitters + + /** + * A generic color splitter - from 0xrrggbb to r, g, b with the name of the parameters passed + * + * @param p_value Number The original _color value + * @return Array An array containing the .name and .value of all new properties + */ + public static function _generic_color_splitter (p_value:Number, p_parameters:Array):Array { + var nArray:Array = new Array(); + nArray.push({name:p_parameters[0], value:AuxFunctions.numberToR(p_value)}); + nArray.push({name:p_parameters[1], value:AuxFunctions.numberToG(p_value)}); + nArray.push({name:p_parameters[2], value:AuxFunctions.numberToB(p_value)}); + return nArray; + } + + + // ================================================================================================================================== + // NORMAL SPECIAL PROPERTY functions ------------------------------------------------------------------------------------------------ + + /** + * Generic function for the textformat properties + */ + public static function _textFormat_property_get (p_obj:Object, p_parameters:Array, p_extra:Object = null):Number { + var fmt:TextFormat = p_obj.getTextFormat(); + var propertyName:String = p_parameters[0]; + var isColor:Boolean = p_parameters[1]; + if (!isColor) { + // Standard property + return (fmt[propertyName]); + } else { + // Composite, color channel + var colorComponent:String = p_parameters[2]; + if (colorComponent == "r") return AuxFunctions.numberToR(fmt[propertyName]); + if (colorComponent == "g") return AuxFunctions.numberToG(fmt[propertyName]); + if (colorComponent == "b") return AuxFunctions.numberToB(fmt[propertyName]); + } + + return NaN; + } + + public static function _textFormat_property_set (p_obj:Object, p_value:Number, p_parameters:Array, p_extra:Object = null): void { + var fmt:TextFormat = p_obj.getTextFormat(); + var propertyName:String = p_parameters[0]; + var isColor:Boolean = p_parameters[1]; + if (!isColor) { + // Standard property + fmt[propertyName] = p_value; + } else { + // Composite, color channel + var colorComponent:String = p_parameters[2]; + if (colorComponent == "r") fmt[propertyName] = (fmt[propertyName] & 0xffff) | (p_value << 16); + if (colorComponent == "g") fmt[propertyName] = (fmt[propertyName] & 0xff00ff) | (p_value << 8); + if (colorComponent == "b") fmt[propertyName] = (fmt[propertyName] & 0xffff00) | p_value; + } + + p_obj.defaultTextFormat = fmt; + p_obj.setTextFormat(fmt); + + } + + } + +} diff --git a/flash/ImageDisplayx1/homelink.fla b/flash/ImageDisplayx1/homelink.fla new file mode 100644 index 0000000000000000000000000000000000000000..1ff11afc97bb088cc23a14d322b1573b593d737a GIT binary patch literal 7835 zcmbt(WmFv9()HjTU?8|BI3WZHfdm=c86>#-z~Js0+}$;V;4Z=4U4lz+*8qbAK63AU z?j!5IzrN~KeY&S>SD&6$XRX?2gQXD=@c{r-0N`bsiXb_b5ds^Z$z?^AL9Zm`#QqZokBa)Q z_h%ILY{oqU08*U+0PLqQ5qVh=YePp%V=D(%7fa}}_JQ4E!}EuuQ5bo{epLT5i(}4l z9s9xU?A*yjpMD-6z@H)9=+ulmLB`ChB+l9r_3M zCo9I^X?Z)zt`@sg+92u~`t`aTAFha&<&yh!BJkI(d0x^!J{M+cT7y_wU0DoP*AgY@av8ba$L)v%~hiAAgO7g61MrWLcR8 z5l~^q8*b)@$R~Y?tWZK0Ut+`cCjOs4qcRQ-4n`dZeQaN$tBhmNHyg9M#K~?jFCJmw z$bE?=*j(&v(SNrR&lhPSSm<3{!2N(vf~-J%*cm_?1BQ-QDq2&(=-Q zg?vQd50*qP9O8*o(7pc#?5JA@Dbh4eLC-y>t8y4Sw}0>KjdB{h%{SXV7rqw`8H^ZF z^k5ct{$?-x%Lm;gRqmZfGPt;i$_dN2X$5K)Ch{r1xT`uBxA*7!x@y|f@69tP1m-}% zM2yuiD3u6Xqc*Z!cekuSYPH_oD>ggoq7@pcrDRHtJ#DX>PF+{r6}%)@|7iD);73wj zZ4;tWvS5#bj5hy7E00|}HsE8=Y#tzX{{8#ZD61Ez=X{(+Z?6fV-x}@7?Rj*+i-07o zZ7qq~4Z`|U&X#+Jp6cmvW@pCVzGU*^=i%e$wKECHIGb~U zJ4V+{Z{NxrzSN_tq;1cN%JRLOFtVCf$ANY1qCZAdMr9elZVei&6d+q~j=tH69 zTn^c%&qG;F5jx7_3+ku&{iL$gWnC%Zb`cq91(z_=IAYC0+DtFc?Fg^Ag!ZBWr{@OH#rD^m!XgYOh5L zXJ;*f*G70aXmbL%5geni^L>lD+LaVtB%3bS;|+>u@y@UudZR<~T5wixS_DG727?y|npoab77Yw6r4L(< z8J2}?@jr*ZCqAZG##@V%9~m?GB~IUL#Noarw&9XUb4!A~uC+gK9_cX^PMWfHu&*2- zG)j885O+QpDH89nbpN!JX$U(`c?Xe`jco0GEETEA@6vur+-AWv88&fSKlCpn#`DCp z>b}g>BgI43`&qxu6ZhIFo3q~lwJdyJcbM{qi=|CLgCz*Pr>6(njrbN3br9NT9#0hE zUXj^u_qD`I%S1^!T1yqSMYyYK#| zRzGA>FCY&uK8jIlbU{2%|MNSZ`zYdPSrgQxy<&W&*9g~3l6e_02HiD!1~z#NGE2kG z7qR5#mSJ~zOKC|<(nJBU_dFbgNG>jRjmFL9J!c_FnD4Z1hOoF>IlZ>jJ*V9UW|8t7 z(0rycj50Z-szk`Q4aMY?j{w^m1-%y>S=W|pTM2Zc7FM|lojLB6VXGlGTv_6wV8Tzs zm~)-pdLQ0oh+ooK14Y!6ab`NKJ$|__m{rVU+KKBm4C8Eg(S{Q|Ry6Le+KUa8pO#QV zpP!%fZrX8R3>9+7>46JIWr92T!iEdU=goNK1IZa@9a5YrM?O(W;;~q7HQHd2FlysMs|!nZp{qP(mKRuJ7ffC>7HPZ zn{#7}wG(lp`B|s~-FaUEfbMRHhm|ZLd@ZeBS89pfnf!3>EYb$poL~WWHpGNOg;URR z`pN=Xc&f^R*i5OX_{K!9tDkN_ccz>2_Dmgl1Nrj2C_bjb?keRMb}oaWKf;=piyTT~ zk3$|%1EidonJfYY-v}ybC_OcKl?`4^hS$16>38HSmFcA#MmB^AoO@8$bVoEx0@E-FGY&+i99i6=0^?92 z&B$y?yO}8$IrS+gf*|~#n*PU<4u$EkLL{YJ>C5I4@j58kdE2T?zk&v?l|1Al5KD%> zuqL)22xJ2>jLKY61!o^Ju7pmeQr853<`OnDUkVz4SRhZ(qavDH@MvE$#L0YFmjPpU zva;_fsxnUFGvmgqqWMYbasb_4AQvh%4_85GkH4f zIZOrN<~Z-s@}>Pbf(MU;g>YN9y?cT*jG{g%1U!8xQ%p4WMuG6=dcl!{g;g~*Fk#RVazsWu!{KMn}f0`~N%dPdr~f{Av&Ld2Pbzv)HfSx936R*cxD~e2yx7z~mk%w9k*Bo>A~DyDhPl zZF+GMAzFhD_RgT1VZ48k;9=M18IzUMbOtiW0Bj3|2t_m0bSUtl0zXOAA+q5~;pYzA zrIAfeUoG{~O5hkho1l^)qnT#~&A&346P1mjH1jw z{qpMdq$swJLqqf?94@+bpkO8ar%p`@9qmqL>hb@M&F0`?sxw-Q>)t5>-3}l|QY0t;q+ZH7`6G>B>PkOs5Wi4F*tagbs#N zD~f=KmvP1NWz%#n85OtyAwn}@@JQ(T`*H9x)qKqM!Dczh8#obKmUa?Kh%bR3-Nn&B z1`4(93KVa?@E+&V)Xu|kgq9l!7A8DnQ7lmaTMUhfm}|Tm>_aQ&7byA?+a!m#KdHaR zMxB6DfHT9vElSNQK2F#Dp2`8umM4H!@*xykb~B#a5^_n{Q~NB6fvJ2GBUQYd9TNQ3 z*LV`=mFUxn@v|NlD4Le!qqpJG11b|#I=`M*7+2c*EgBIRdX#-7g@fNLev}}`pm<7A zdmSwfkKWwp>)4;7N*mm@?Gd`42Et^dn98}A!r>e%HWvHn)vYW`W-NwlDcK)h^zen} zQ+g->g-z;X8l=itE)ClkJiRSUg*1E9vF!DW1ALOpXN&iv&S{CnUMI*>?Cr72c*pOoWqN(rGK!)lfrD;X8y-i39k>RJ-Ie{Sha7i5V3*)*dP zB0**MZpZobF`Z0PjXo^djr+q)8LXDl@lv48>mYTk@%DNf=h+5-7EIR)&&&1BadUaa zC3%njDyEhyjP04LRIMnHNGwYuukm^)-X#wQg7%R1WLnwEQ0urC=2&g3M8o%zu2d9F zutg59dGe9dUA2iIA{-}x-TbR839>I(Q@7Fc^Gazz#K5PGvZ=zRGJeUaWB^;%*ujOE z_RCp-emFeijBeXZPEBf3g(%(P5R=L8T=+maVy^!>8hnza7p3y zq7Tlj-j@;7l+W|jBfa#&@e-QR2|E;qU!^+Cq?{QuaJ#$P5o_xh-?!e8b=;qwOUAz+ z6SAu)xRJK#XqIJMhX6O9n^LU7VY|jleSB7<`D{C;QbH(ofin_eHBX&@Eo`naa>GYs zZFH~HyFAwLokxRvCyuh{paYvUWn_Gw@o)!Hl0mAA2b&T)nQ9&@493H-<<-18-9^n4 zW+e3@DvPI%ecCe%H`u1wpOkOOj=T?qij6$t>t8uxCOmt1eGxc^^-7=ohivtJY2_jD zT1* zUDEwdSuKp_^r9{VLgV_yUG;UqtTddu%nEvdo9hd=8~;(33d0tG;n##mXIn`^Cp%;G z9~LO(%;_9LeJi#c1w=w^c?-}^w3!nqiBmq}(x!As?KqF?PR<`pix<3_3Yc@qxCXaL zV%FL}XkMQ5uLOwArq5@ivS3mc>P2Da5fYX(dwU)Fm6kO5mlJ*20;vysXTpj^tY|vv z6Xyq=Ym)f2+;ct}sjP5hN|}6g?;%%jHc@RPR8Vo3o({t1VlL)YDaPZQBik$1*gPs1 zj{WQL$TSdBd!rOBUQ#@EiFfyp&7mf(e)f!~EhbJ%008f4ae*BTpb&dAC1VE%h?S}R zzm}HzvehClu=PZVsAFA^P+}vi+j5}+zS%azC@Q0|cJWZu$0x=tE#hSnzA?RLo@bbp( zQovh%>z^myuOz9jHT0iL(i-2qf z``L(qq#= z=qm*x0TNi|#B-W`3(f-cjwoa=iOnD0BcTrNK|Z&6_D0~=HB6%ZNyUSI{yV+oX8B{T?7E1uf9TAkpe z;z_diOdpWYXI>>>q{R7y)In1gNM6&0hZa_Qp>+nji|Jmc%dl6AD^MKe&KMI@?#xB7 ztt7KT4O0MeAC;%_ArbDyqAZVknYPuh^1$Ubt%~oHQ!TIHg8SwIyEOx%T@bo8ao+7A zOaxuw30`AYE>h#5{sa@?r#oCLIA4F}l*IZf3rnrG%S%637DDf>m6Bb1Ec#ZcMO*Byh7&A9$JYWbFbOq1xj2(V`iU9s zNOEe1NPMGrCCxkMI+5s2dI7EEcTrjm3h&caV{}`Y$Jv@RGs`m2BMKo%W4s{P!S!e&+Zl-J2irlDu{B# zoA5?%RX55-ZH?ueKr-)px)hq&)@&Dp{@!Ikmk2rAkU=u973_Pk1ia#XqE6J=2eXXP zsIsJWl698>l}}*B*`2Vx%>^h9UIEsN8q1qhYeFMOQ4!t|)pso<>n7X+{;o*R7tWRK zG*6-3^^Ax$`JDVF@QDW$HqwxLjFASgv^fJ-7hCcJPW|V3KD0OtkPxr(fP$z4!bRS8 z!-a0Zh!(mOFys8v%f>}@GoC&r+m)iZR){vYhu?|~B_UMnJFd+P%qK-axyw(~VKj_W z@wo-oStRN^iorum@o%bFUCm))i!Wf$4;QzeypUb{IcY;IUgNSCa>kM_jrUX5hB=`G#@nV35}++F2i z7xKEStYiH5S9xpah#M+O^io-i)tK=HwSLLT3UDAgN4X{6?>&;4*588RRp$(@4kx`b z&asq+HV`y+X_hO}J6O{goPCtBZ0+OFeVBM4-?1jjdH7n>@cMCoVi<)mr5|9)eK_8& z#;Zr6Y55E^aV?PVh~;of4RApR1!Z2{O#18L`(v#t$-N2R&;gd6y=2&{f~ZOG=jzKK zVnyyq}h}z!;;@6ulqAXLWb-^%)4o?_Pjx|DYQEYpf z)Yi%Kwf@Iy^Zg|6huxYEpXSm}))Iq2E^1HfB4+ljh&mu%fEXZ*>xviQl&d?_r9#$4 z(MovcG=Mt$MUe0`y6P{(Y6`UH%ngY>$LDLrcd)gwnuE2ZF2%T($MBdeofxNjjCjNs zRNQAmex{weDT{u&?A&KYVW`gyxi-!+6Z^_Ba8WE6tFMo)*!|aEiCRPZ_lg&oMiHQA?%>L!N@E{aA{R45 zQ^0&K=}f`Y)$!Kj)2p5Uy*!T-k01MY_X`Jq3A7mdwLbsO3>B75(W%jJy+dGF~Rd3@NWrSt1y`mm6H z&3D6Yb`^;g{mD9TVZ(ULaN@i17;4yT zQ1%i;zHu%h*-D|7RPCTX@sD{1OE(VgPlMLZZ~ux!UTOw0v`85KT#ljMqtgYLiA?weP32|sC8kY!W5`?qZV0cCLU6Q#!(I9_j zKi9N&^dpTU^|g!pm^>^n6Ak#r19yVZi;^81)$g;b*r_;qO;m9~0P^=}^4|GW#O0Mr z`cj42e#L^m1$Q%5XxA^kFbvE@DA#9 z9*u??R1ZCjt*@(Vu0tpf`Z5$d4YMebqOZj{{avpjHR>@bVQ)F1g=VBRL%oFIM6cPF zf^V8#_IzBw3w6yrTnM$W&6#4@?<_6r0V&Glzm>6?RuS?;;*VHO2LpOOL>z`e#@~2@ z*a~)qrHHYOv6T_4p}wJ+vFX##ODOOFBmm))dWQz!eY*c`t))-R z(%(e8rq~~W#7|Ft`)|?C67ob)Ty2c?ZETRl_e-R`94f})6 z{Zo$o5AJF3dGddVli>f%^bhbqx!|8*!6#|+zwi7jGyG?Ye|EforpS0Ing7xM{+Zx^ z7ulZ)EJ*)%$^HF*`)ASpiBEgN|Bn*G%i_ L0GRwPa=`xsOS#PE literal 0 HcmV?d00001