Package | starling.animation |
Class | public class BezierEasing |
Inheritance | BezierEasing Object |
For example, you can add the transitions recommended by Google's Material Design standards (see here) like this:
Transitions.register("standard", BezierEasing.create(0.4, 0.0, 0.2, 1.0)); Transitions.register("decelerate", BezierEasing.create(0.0, 0.0, 0.2, 1.0)); Transitions.register("accelerate", BezierEasing.create(0.4, 0.0, 1.0, 1.0));
The create
method returns a function that can be registered directly
at the "Transitions" class.
Code based on gre/bezier-easing and its Starling adaptation by Rodrigo Lopez.
See also
Method | Defined By | ||
---|---|---|---|
create(x1:Number, y1:Number, x2:Number, y2:Number):Function [static] Create an easing function that's defined by two control points of a bezier curve. | BezierEasing |
create | () | method |
public static function create(x1:Number, y1:Number, x2:Number, y2:Number):Function
Create an easing function that's defined by two control points of a bezier curve. The curve will always go directly through points 0 and 3, which are fixed at (0, 0) and (1, 1), respectively. Points 1 and 2 define the curvature of the bezier curve.
The result of this method is best passed directly to
Transitions.create()
.
Parameters
x1:Number — The x coordinate of control point 1.
| |
y1:Number — The y coordinate of control point 1.
| |
x2:Number — The x coordinate of control point 2.
| |
y2:Number — The y coordinate of control point 2.
|
Function — The transition function, which takes exactly one 'ratio:Number' parameter.
|