mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
add scrollx1 flash src & add flash file to builder
This commit is contained in:
@@ -74,6 +74,7 @@ $finder
|
|||||||
->name('hudson')
|
->name('hudson')
|
||||||
->name('.svn')
|
->name('.svn')
|
||||||
->name('.git')
|
->name('.git')
|
||||||
|
->name('flash')
|
||||||
->ignoreDotFiles(false)
|
->ignoreDotFiles(false)
|
||||||
->ignoreVCS(false)
|
->ignoreVCS(false)
|
||||||
->in(__DIR__);
|
->in(__DIR__);
|
||||||
|
92
flash/ImageDisplayx1/caurina/transitions/AuxFunctions.as
Normal file
92
flash/ImageDisplayx1/caurina/transitions/AuxFunctions.as
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
714
flash/ImageDisplayx1/caurina/transitions/Equations.as
Normal file
714
flash/ImageDisplayx1/caurina/transitions/Equations.as
Normal file
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
90
flash/ImageDisplayx1/caurina/transitions/PropertyInfoObj.as
Normal file
90
flash/ImageDisplayx1/caurina/transitions/PropertyInfoObj.as
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
49
flash/ImageDisplayx1/caurina/transitions/SpecialProperty.as
Normal file
49
flash/ImageDisplayx1/caurina/transitions/SpecialProperty.as
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
236
flash/ImageDisplayx1/caurina/transitions/TweenListObj.as
Normal file
236
flash/ImageDisplayx1/caurina/transitions/TweenListObj.as
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
1105
flash/ImageDisplayx1/caurina/transitions/Tweener.as
Normal file
1105
flash/ImageDisplayx1/caurina/transitions/Tweener.as
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
BIN
flash/ImageDisplayx1/homelink.fla
Normal file
BIN
flash/ImageDisplayx1/homelink.fla
Normal file
Binary file not shown.
Reference in New Issue
Block a user