Package | com.greensock.easing |
Class | public class Ease |
Inheritance | Ease ![]() |
Subclasses | Linear, SlowMo, SteppedEase |
All Ease instances have a getRatio()
method that is responsible
for the translation of the progress ratio which the tween typically feeds in.
End users almost never need to directly feed any values to or get any values from
an Ease instance - the tweens will do that internally.
The base Ease class handles most of the common power-based easeIn/easeOut/eaesInOut calculations (like Linear, Quad, Cubic, Quart, Quint, and Strong) internally. You can define a separate function that uses what was considered the 4 standard easing parameters by Adobe and many others (time, start, change, duration) and Ease will serve as a proxy in order to maximize backwards compatibility and usability. For example, if you have a custom method that you created like this:
function myEase(t:Number, s:Number, c:Number, d:Number):Number { return s+(t=t/d); }
import com.greensock.*; import com.greensock.easing.*; TweenLite.to(mc, 5, {x:600, ease:new Ease(myEase)});
In the above example, the anytime the Ease's getRatio()
method is called, it
would feed the first parameter as a ratio between 0 and 1 and the rest of the 3 parameters
would always be 0, 1, 1. This is all done transparently by TweenLite/TweenMax, so you
really shouldn't need to worry about this.
Copyright 2012, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for Club GreenSock members, the software agreement that was issued with the membership.
Method | Defined By | ||
---|---|---|---|
Ease(func:Function = null, extraParams:Array = null, type:Number = 0, power:Number = 0)
Constructor
| Ease | ||
getRatio(p:Number):Number
Translates the tween's progress ratio into the corresponding ease ratio. | Ease |
Ease | () | Constructor |
public function Ease(func:Function = null, extraParams:Array = null, type:Number = 0, power:Number = 0)
Constructor
Parametersfunc:Function (default = null ) — Function (if any) that should be proxied. This is completely optional and is in fact rarely used except when you have your own custom ease function that follows the standard ease parameter pattern like time, start, change, duration.
| |
extraParams:Array (default = null ) — If any extra parameters beyond the standard 4 (time, start, change, duration) need to be fed to the func function, define them as an array here. For example, the old Elastic.easeOut accepts 2 extra parameters in its standard equation (although the newer GreenSock version uses the more modern config() method for configuring the ease and doesn't require any extraPrams here)
| |
type:Number (default = 0 ) — Integer indicating the type of ease where 1 is easeOut, 2 is easeIn, 3 is easeInOut, and 0 is none of these.
| |
power:Number (default = 0 ) — Power of the ease where Linear is 0, Quad is 1, Cubic is 2, Quart is 3, Quint (and Strong) is 4, etc.
|
getRatio | () | method |
public function getRatio(p:Number):Number
Translates the tween's progress ratio into the corresponding ease ratio. This is the heart of the Ease, where it does all its work.
Parameters
p:Number — progress ratio (a value between 0 and 1 indicating the progress of the tween/ease)
|
Number — translated number
|