ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
fl.motion 

BezierSegment  - AS3 Flash

Packagefl.motion
Classpublic class BezierSegment
InheritanceBezierSegment Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

A Bezier segment consists of four Point objects that define a single cubic Bezier curve. The BezierSegment class also contains methods to find coordinate values along the curve.

Related API Elements



Public Properties
 PropertyDefined By
  a : Point
The first point of the Bezier curve.
BezierSegment
  b : Point
The second point of the Bezier curve.
BezierSegment
  c : Point
The third point of the Bezier curve.
BezierSegment
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  d : Point
The fourth point of the Bezier curve.
BezierSegment
Public Methods
 MethodDefined By
  
Constructor for BezierSegment instances.
BezierSegment
  
[static] Calculates the coefficients for a cubic polynomial equation, given the values of the corresponding cubic Bezier equation.
BezierSegment
  
getCubicRoots(a:Number = 0, b:Number = 0, c:Number = 0, d:Number = 0):Array
[static] Finds the real solutions, if they exist, to a cubic polynomial equation of the form: at^3 + bt^2 + ct + d.
BezierSegment
  
[static] Finds the real solutions, if they exist, to a quadratic equation of the form: at^2 + bt + c.
BezierSegment
  
getSingleValue(t:Number, a:Number = 0, b:Number = 0, c:Number = 0, d:Number = 0):Number
[static] Calculates the value of a one-dimensional cubic Bezier equation at a specific time.
BezierSegment
  
Calculates the location of a two-dimensional cubic Bezier curve at a specific time.
BezierSegment
  
getYForX(x:Number, coefficients:Array = null):Number
Finds the y value of a cubic Bezier curve at a given x coordinate.
BezierSegment
 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 this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail

a

property
public var a:Point

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The first point of the Bezier curve. It is a node, which means it falls directly on the curve.

b

property 
public var b:Point

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The second point of the Bezier curve. It is a control point, which means the curve moves toward it, but usually does not pass through it.

c

property 
public var c:Point

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The third point of the Bezier curve. It is a control point, which means the curve moves toward it, but usually does not pass through it.

d

property 
public var d:Point

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

The fourth point of the Bezier curve. It is a node, which means it falls directly on the curve.

Constructor Detail

BezierSegment

()Constructor
public function BezierSegment(a:Point, b:Point, c:Point, d:Point)

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Constructor for BezierSegment instances.

Parameters
a:Point — The first point of the curve, a node.
 
b:Point — The second point of the curve, a control point.
 
c:Point — The third point of the curve, a control point.
 
d:Point — The fourth point of the curve, a node.

Related API Elements

Method Detail

getCubicCoefficients

()method
public static function getCubicCoefficients(a:Number, b:Number, c:Number, d:Number):Array

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Calculates the coefficients for a cubic polynomial equation, given the values of the corresponding cubic Bezier equation.

Parameters

a:Number — The first value of the Bezier equation.
 
b:Number — The second value of the Bezier equation.
 
c:Number — The third value of the Bezier equation.
 
d:Number — The fourth value of the Bezier equation.

Returns
Array — An array containing four number values, which are the coefficients for a cubic polynomial. The coefficients are ordered from the highest degree to the lowest, so the first number in the array would be multiplied by t^3, the second by t^2, and so on.

Related API Elements

getCubicRoots

()method 
public static function getCubicRoots(a:Number = 0, b:Number = 0, c:Number = 0, d:Number = 0):Array

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Finds the real solutions, if they exist, to a cubic polynomial equation of the form: at^3 + bt^2 + ct + d. This method is used to evaluate custom easing curves.

Parameters

a:Number (default = 0) — The first coefficient of the cubic equation, which is multiplied by the cubed variable (t^3).
 
b:Number (default = 0) — The second coefficient of the cubic equation, which is multiplied by the squared variable (t^2).
 
c:Number (default = 0) — The third coefficient of the cubic equation, which is multiplied by the linear variable (t).
 
d:Number (default = 0) — The fourth coefficient of the cubic equation, which is the constant.

Returns
Array — An array of number values, indicating the real roots of the equation. There may be no roots, or as many as three. Imaginary or complex roots are ignored.

getQuadraticRoots

()method 
public static function getQuadraticRoots(a:Number, b:Number, c:Number):Array

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Finds the real solutions, if they exist, to a quadratic equation of the form: at^2 + bt + c.

Parameters

a:Number — The first coefficient of the quadratic equation, which is multiplied by the squared variable (t^2).
 
b:Number — The second coefficient of the quadratic equation, which is multiplied by the linear variable (t).
 
c:Number — The third coefficient of the quadratic equation, which is the constant.

Returns
Array — An array of number values, indicating the real roots of the equation. There may be no roots, or as many as two. Imaginary or complex roots are ignored.

getSingleValue

()method 
public static function getSingleValue(t:Number, a:Number = 0, b:Number = 0, c:Number = 0, d:Number = 0):Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Calculates the value of a one-dimensional cubic Bezier equation at a specific time. By contrast, a Bezier curve is usually two-dimensional and uses two of these equations, one for the x coordinate and one for the y coordinate.

Parameters

t:Number — The time or degree of progress along the curve, as a decimal value between 0 and 1.

Note: The t parameter does not necessarily move along the curve at a uniform speed. For example, a t value of 0.5 does not always produce a value halfway along the curve.

 
a:Number (default = 0) — The first value of the Bezier equation.
 
b:Number (default = 0) — The second value of the Bezier equation.
 
c:Number (default = 0) — The third value of the Bezier equation.
 
d:Number (default = 0) — The fourth value of the Bezier equation.

Returns
Number — The value of the Bezier equation at the specified time.

getValue

()method 
public function getValue(t:Number):Point

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Calculates the location of a two-dimensional cubic Bezier curve at a specific time.

Parameters

t:Number — The time or degree of progress along the curve, as a decimal value between 0 and 1.

Note: The t parameter does not necessarily move along the curve at a uniform speed. For example, a t value of 0.5 does not always produce a value halfway along the curve.

Returns
Point — A point object containing the x and y coordinates of the Bezier curve at the specified time.

getYForX

()method 
public function getYForX(x:Number, coefficients:Array = null):Number

Language Version: ActionScript 3.0
Product Version: Flash CS3
Runtime Versions: Flash Player 9.0.28.0, AIR 1.0

Finds the y value of a cubic Bezier curve at a given x coordinate. Some Bezier curves overlap themselves horizontally, resulting in more than one y value for a given x value. In that case, this method will return whichever value is most logical. Used by CustomEase and BezierEase interpolation.

Parameters

x:Number — An x coordinate that lies between the first and last point, inclusive.
 
coefficients:Array (default = null) — An optional array of number values that represent the polynomial coefficients for the Bezier. This array can be used to optimize performance by precalculating values that are the same everywhere on the curve and do not need to be recalculated for each iteration.

Returns
Number — The y value of the cubic Bezier curve at the given x coordinate.