ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
fl.motion 

FunctionEase  - AS3 Flash

Packagefl.motion
Classpublic class FunctionEase
InheritanceFunctionEase Inheritance Object
Implements ITween

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The FunctionEase class allows custom interpolation functions to be used with the fl.motion framework in place of other interpolations like SimpleEase and CustomEase. The fl.motion framework includes several easing functions in the fl.motion.easing package.

View the examples

Related API Elements



Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  easingFunction : Function = null
A reference to a function with a (t, b, c, d) signature like the methods in the fl.motion.easing classes.
FunctionEase
  functionName : String
The fully qualified name of an easing function, such as fl.motion.easing.Bounce.easeOut().
FunctionEase
  parameters : Array = null
An optional array of values to be passed to the easing function as additional arguments.
FunctionEase
  target : String
The name of the animation property to target.
FunctionEase
Public Methods
 MethodDefined By
  
FunctionEase(xml:XML = null)
Constructor for FunctionEase instances.
FunctionEase
  
getValue(time:Number, begin:Number, change:Number, duration:Number):Number
Calculates an interpolated value for a numerical property of animation, using the specified easing function.
FunctionEase
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail

easingFunction

property
public var easingFunction:Function = null

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A reference to a function with a (t, b, c, d) signature like the methods in the fl.motion.easing classes.

Related API Elements

functionName

property 
functionName:String

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The fully qualified name of an easing function, such as fl.motion.easing.Bounce.easeOut(). The function must be a method of a class (Bounce, Cubic, Elastic, another class). If Flash Player cannot find the class, an exception is thrown.



Implementation
    public function get functionName():String
    public function set functionName(value:String):void

Related API Elements

parameters

property 
public var parameters:Array = null

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

An optional array of values to be passed to the easing function as additional arguments.

target

property 
target:String

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The name of the animation property to target.



Implementation
    public function get target():String
    public function set target(value:String):void

Related API Elements

Constructor Detail

FunctionEase

()Constructor
public function FunctionEase(xml:XML = null)

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Constructor for FunctionEase instances.

Parameters
xml:XML (default = null) — An optional E4X XML instance.

Related API Elements

Method Detail

getValue

()method
public function getValue(time:Number, begin:Number, change:Number, duration:Number):Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Calculates an interpolated value for a numerical property of animation, using the specified easing function. If the parameters array has been set beforehand, those values will be passed to the easing function in addition to the time, begin, change, and duration values.

Parameters

time:Number — The time value, which must lie between 0 and duration, inclusive. You can choose any unit (for example, frames, seconds, milliseconds), but your choice must match the duration unit.
 
begin:Number — The value of the animation property at the start of the tween, when time is 0.
 
change:Number — The change in the value of the animation property over the course of the tween. The value can be positive or negative. For example, if an object rotates from 90 to 60 degrees, the change is -30.
 
duration:Number — The length of time for the tween. Must be greater than zero. You can choose any unit (for example, frames, seconds, milliseconds), but your choice must match the time unit.

Returns
Number — The interpolated value at the specified time.
FunctionEaseExample.as

This example uses the Back effect from the fl.motion.easing package as a custom function ease:
import fl.motion.Animator;
//// These two lines must be added to use <FunctionEase>
import fl.motion.easing.*; // import the easing classes
fl.motion.easing.Back; // add a reference to every easing class you want to use
////
var mc2_xml:XML = <Motion duration="30" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
    <source>
        <Source frameRate="30" x="85.05" y="90.05" scaleX="0.999" scaleY="0.999" rotation="0" elementType="movie clip" instanceName="mc2" symbolName="BoxSymbol" linkageID="Box" class="Box">
            <dimensions>
                <geom:Rectangle left="-39" top="-52" width="77" height="97"/>
            </dimensions>
            <transformationPoint>
                <geom:Point x="0.5019480519480519" y="0.5010309278350515"/>
            </transformationPoint>
        </Source>
    </source>

    <Keyframe index="0">
        <tweens>
            <FunctionEase functionName="fl.motion.easing.Back.easeInOut"/>
        </tweens>
    </Keyframe>

    <Keyframe index="29" x="330" y="0"/>
</Motion>;

var mc2_animator:Animator = new Animator(mc2_xml, mc2);
mc2_animator.play();