View comments | RSS feed
Packagefl.transitions.easing
Classpublic class Elastic
InheritanceElastic Inheritance Object

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

The Elastic class defines three easing functions to implement motion with ActionScript animation, where the motion is defined by an exponentially decaying sine wave.

See also

fl.transitions.TransitionManager


Public Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined By
  
easeIn(t:Number, b:Number, c:Number, d:Number, a:Number = 0, p:Number = 0):Number
[static] The easeIn() method starts motion slowly and then accelerates motion as it executes.
Elastic
  
[static] The easeInOut() method combines the motion of the easeIn() and easeOut() methods to start the motion slowly, accelerate motion, then decelerate.
Elastic
  
easeOut(t:Number, b:Number, c:Number, d:Number, a:Number = 0, p:Number = 0):Number
[static] The easeOut() method starts motion fast and then decelerates motion as it executes.
Elastic
 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 the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Method Detail
easeIn()method
public static function easeIn(t:Number, b:Number, c:Number, d:Number, a:Number = 0, p:Number = 0):Number

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

The easeIn() method starts motion slowly and then accelerates motion as it executes.

Parameters

t:Number — Specifies the current time, between 0 and duration inclusive.
 
b:Number — Specifies the initial value of the animation property.
 
c:Number — Specifies the total change in the animation property.
 
d:Number — Specifies the duration of the motion.
 
a:Number (default = 0) — Specifies the amplitude of the sine wave.
 
p:Number (default = 0) — Specifies the period of the sine wave.

Returns
Number — The value of the interpolated property at the specified time.

See also


Example

This example animates a rectangle using the Elastic.easeIn easing function:
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, "x", Elastic.easeIn, startValue, finishValue, duration, true);
myTween.looping = true;
easeInOut()method 
public static function easeInOut(t:Number, b:Number, c:Number, d:Number, a:Number = 0, p:Number = 0):Number

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

The easeInOut() method combines the motion of the easeIn() and easeOut() methods to start the motion slowly, accelerate motion, then decelerate.

Parameters

t:Number — Specifies the current time, between 0 and duration inclusive.
 
b:Number — Specifies the initial value of the animation property.
 
c:Number — Specifies the total change in the animation property.
 
d:Number — Specifies the duration of the motion.
 
a:Number (default = 0) — Specifies the amplitude of the sine wave.
 
p:Number (default = 0) — Specifies the period of the sine wave.

Returns
Number — The value of the interpolated property at the specified time.

See also


Example

This example animates a rectangle using the Elastic.easeInOut easing function:
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, "x", Elastic.easeInOut, startValue, finishValue, duration, true);
myTween.looping = true;
easeOut()method 
public static function easeOut(t:Number, b:Number, c:Number, d:Number, a:Number = 0, p:Number = 0):Number

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9.0

The easeOut() method starts motion fast and then decelerates motion as it executes.

Parameters

t:Number — Specifies the current time, between 0 and duration inclusive.
 
b:Number — Specifies the initial value of the animation property.
 
c:Number — Specifies the total change in the animation property.
 
d:Number — Specifies the duration of the motion.
 
a:Number (default = 0) — Specifies the amplitude of the sine wave.
 
p:Number (default = 0) — Specifies the period of the sine wave.

Returns
Number — The value of the interpolated property at the specified time.

See also


Example

This example animates a rectangle using the Elastic.easeOut easing function:
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, "x", Elastic.easeOut, startValue, finishValue, duration, true);
myTween.looping = true;




 



Comments


devonair said on Apr 29, 2007 at 9:20 AM :
How do we make use of the a and p arguments (or s argument in the Back class)? Taking a peak at the intrinsic Tween class it seems to ignore those additional arguments. Is there something I'm not seeing correctly? Thanks in advance to anyone who can shed some light on this..
djtechwriter said on May 3, 2007 at 12:27 PM :
devonair,

You're using the Easing class functions as parameters for the Tween constructor. The Easing class functions are passed to Tween and TransitionManager as parameters and carry the default values for the easing parameters with them. Tween and TransitionManager do not provide a way to insert new values for those parameters within the Tween and TransitionManager constructors. If you call the Easing class functions directly in your own custom code, you can pass new values, and so they are listed here.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/transitions/easing/Elastic.html