Stepped produces values between 0.0 and 1.0 which are rounded up or down to nearby values
so that they jump from one sample to the next creating a stairstep motion. It gives
the impression of low-tech computer graphics.
The easing classes provide static methods for interpolating the change between two values over time.
Each class handles the interpolation, or easing, differently. Each class typically contains three methods
- easeIn(), easeOut() and easeInOut() - which vary the rate of change
of the values. Most of the easing functions produce values as a percentage - a number between 0.0 and 1.0
public static function ease(timeElapsed:Number, duration:Number, steps:Number = 10):Number
Produces values that are cropped to a threshold based on the number of steps specified.
For example, if there are 3 steps, the values will jump from 0 to 0.5 to 1.0
If 10 steps are specified, the values will jump from 0 to 0.1 to 0.2, ..., to 1.0
Parameters
| timeElapsed:Number — The time since the tween began in milliseconds or frames.
|
| |
| duration:Number — The duration of the tween, in milliseconds or frames.
|
| |
| steps:Number (default = 10) — The number of steps to take. Must be an integer greater than 0.
Generally, if steps > duration, you're better off using the Linear.ease().
|
Returns
| Number — percentage complete - between 0.0 and 1.0
|
Throws
| — If steps is less than 1.
|
public static function getSteppedFunction(easingFunction:Function, steps:int = 10):Function
Creates a stepped easing function based on another easing function that uses the same method as the
ease() method.
Parameters
| easingFunction:Function — The original easing function to use to create ne new function.
|
| |
| steps:int (default = 10) — The number of steps to take. Must be an integer greater than 0.
Generally, if steps > duration, you're better off using the original function.
|
Returns
| Function — A new easing function that adds stepping to the original easingFunction.
|
Example
The following code will create a new Tween object which will move with Cubic motion over
the course of 15 steps.
var steppedCubic:Tween = new Tween(foo, "bar", 0, 100, 30, Stepped.getSteppedFunction(Cubic.easeInOut, 15));