API Documentation | All Packages | All Classes | Index | Frames No Frames |
Class SteppedEase

Package | com.greensock.easing
Class | public class SteppedEase

Most easing equations give a smooth, gradual transition between the start and end values, but SteppedEase provides an easy way to define a specific number of steps that the transition should take. For example, if mc.x is 0 and you want to tween it to 100 with 5 steps (20, 40, 60, 80, and 100) over the course of 2 seconds, you'd do:
`TweenLite.to(mc, 2, {x:100, ease:SteppedEase.create(5)});
` EXAMPLE CODE
`import com.greensock.TweenLite;
import com.greensock.easing.SteppedEase;
TweenLite.to(mc, 2, {x:100, ease:SteppedEase.create(5)});
//or create an instance directly
var steppedEase:SteppedEase = new SteppedEase(5);
TweenLite.to(mc, 3, {y:300, ease:steppedEase.ease});`
Note: SteppedEase is optimized for use with the GreenSock tweenining platform, so it isn't intended to be used with other engines. Specifically, its easing equation always returns values between 0 and 1.
Copyright 2011, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for corporate Club GreenSock members, the software agreement that was issued with the corporate membership.

Public Properties

| Property | Defined by
--- | --- | ---
|  | steps : int [read-only] Number of steps between the start and the end values. | SteppedEase

Public Methods

| Method | Defined by
--- | --- | ---
|  | SteppedEase(steps:int) Constructor | SteppedEase
|  | create(steps:int):Function [static] This static function provides a quick way to create a SteppedEase and immediately reference its ease function in a tween, like: `TweenLite.to(mc, 2, {x:100, ease:SteppedEase.create(5)});` | SteppedEase
|  | ease(t:Number, b:Number, c:Number, d:Number):Number Easing function that interpolates values. | SteppedEase

Property detail

steps | property

`steps:int` [read-only]

Number of steps between the start and the end values.

Implementation
`public function get steps():int`
Constructor detail

SteppedEase | () | constructor

`public function SteppedEase(steps:int)`

Constructor

Parameters

| `steps:int` — Number of steps between the start and the end values.

Method detail

create | () | method

`public static function create(steps:int):Function`

This static function provides a quick way to create a SteppedEase and immediately reference its ease function in a tween, like:
`TweenLite.to(mc, 2, {x:100, ease:SteppedEase.create(5)});
`

Parameters

| `steps:int` — Number of steps between the start and the end values.

Returns

| `Function` — The easing function that can be plugged into a tween

ease | () | method |

`public function ease(t:Number, b:Number, c:Number, d:Number):Number`

Easing function that interpolates values.

Parameters

| `t:Number` — time
| `b:Number` — start (should always be 0)
| `c:Number` — change (should always be 1)
| `d:Number` — duration

Returns

| `Number` — Result of the ease