Packageorg.as3lib.kitchensync.easing
Classpublic class EasingUtil

A package of handy methods for working with Easing functions and classes.



Public Methods
 MethodDefined by
  
call(func:Function, timeElapsed:Number, duration:Number, mod1:Number, mod2:Number):Number
[static] Provides a way to call an easing function with code-hinting and type checking (sorta).
EasingUtil
  
generateArray(func:Function, steps:int, mod1:Number, mod2:Number):Array
[static] Uses one of the easing functions to generate an array of results for as many steps as are specified.
EasingUtil
  
getAveragedFunction(easingFunction1:Function, easingFunction2:Function):Function
[static] Creates a new easing function based on two other easing functions.
EasingUtil
Method detail
call()method
public static function call(func:Function, timeElapsed:Number, duration:Number, mod1:Number, mod2:Number):Number

Provides a way to call an easing function with code-hinting and type checking (sorta).

Parameters
func:Function — - The function to call - Must be an Easing function.
 
timeElapsed:Number — - The time since the tween began in milliseconds or frames.
 
duration:Number — - The duration of the tween, in milliseconds or frames.
 
mod1:Number — - An optional modifier for the function. Used for tweens such as Back and Elastic.
 
mod2:Number — - An optional modifier for the function. Used for tweens such as Elastic.

Returns
Number — Number - the result of the easing function.

Throws
— - If the easing function is passed modifiers that it can't handle. (Don't use them unless they're handled by the function)
 
— - You may get unexpected results if you use a function that isn't an easing function.
generateArray()method 
public static function generateArray(func:Function, steps:int, mod1:Number, mod2:Number):Array

Uses one of the easing functions to generate an array of results for as many steps as are specified. If steps is 10, you will have an array with length 10.

Parameters
func:Function — - The function to call - Must be an Easing function.
 
steps:int — - The number of results desired for the array.
 
mod1:Number — - An optional modifier for the function. Used for tweens such as Back and Elastic.
 
mod2:Number — - An optional modifier for the function. Used for tweens such as Elastic.

Returns
Array — Array - An array with the results from the easing function over 'steps' iterations.

See also

getAveragedFunction()method 
public static function getAveragedFunction(easingFunction1:Function, easingFunction2:Function):Function

Creates a new easing function based on two other easing functions.

Parameters
easingFunction1:Function — One of the two easing functions that will be averaged by the new function.
 
easingFunction2:Function — The second of the two easing functions that will be averaged by the new function.

Returns
Function — A new easing function that produces values averaged from the two easing functions.

Example
Combine cubic in/out easing with a sine wave oscillator.
       myTween.easingFunction = EasingUtil.getAveragedFunction(Cubic.easeInOut, Oscillate.sine);