ExpressiveShapeCubic class
This class holds the anchor and control point data for a single cubic Bézier curve, with anchor points (anchor0X, anchor0Y) and (anchor1X, anchor1Y) at either end and control points (control0X, control0Y) and (control1X, control1Y) determining the slope of the curve between the anchor points.
AndroidX's Cubic, renamed so an import of it never hides Flutter's Cubic
curve.
- Annotations
Constructors
- ExpressiveShapeCubic(double anchor0X, double anchor0Y, double control0X, double control0Y, double control1X, double control1Y, double anchor1X, double anchor1Y)
-
Creates a ShapeCubic that holds the anchor and control point data for a
single Bézier curve, with anchor points (
anchor0X,anchor0Y) and (anchor1X,anchor1Y) at either end and control points (control0X,control0Y) and (control1X,control1Y) determining the slope of the curve between the anchor points. - ExpressiveShapeCubic.circularArc(double centerX, double centerY, double x0, double y0, double x1, double y1)
-
Generates a bezier curve that approximates a circular arc, with p0 and
p1 as the starting and ending anchor points. The curve generated is the
smallest of the two possible arcs around the entire 360-degree circle.
Arcs of greater than 180 degrees should use more than one arc together.
Note that p0 and p1 should be equidistant from the center.
factory
- ExpressiveShapeCubic.empty(double x0, double y0)
- Generates an empty ShapeCubic defined at (x0, y0).
- ExpressiveShapeCubic.fromPoints(ExpressivePoint anchor0, ExpressivePoint control0, ExpressivePoint control1, ExpressivePoint anchor1)
-
A curve between
anchor0andanchor1with the given control points. - ExpressiveShapeCubic.straightLine(double x0, double y0, double x1, double y1)
-
Generates a bezier curve that is a straight line between the given anchor
points. The control points lie 1/3 of the distance from their respective
anchor points.
factory
Properties
- anchor0X → double
-
The x coordinate of the first anchor point.
no setter
- anchor0Y → double
-
The y coordinate of the first anchor point.
no setter
- anchor1X → double
-
The x coordinate of the second anchor point.
no setter
- anchor1Y → double
-
The y coordinate of the second anchor point.
no setter
- control0X → double
-
The x coordinate of the first control point.
no setter
- control0Y → double
-
The y coordinate of the first control point.
no setter
- control1X → double
-
The x coordinate of the second control point.
no setter
- control1Y → double
-
The y coordinate of the second control point.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
-
points
→ List<
double> -
The eight coordinates of the curve: anchor 0, control 0, control 1 and anchor 1, each as x then y.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
calculateBounds(
List< double> bounds, {bool approximate = false}) → void -
Returns the true bounds of this curve, filling
boundswith the axis-aligned bounding box values for left, top, right, and bottom, in that order. -
convexTo(
ExpressiveShapeCubic next) → bool -
Whether the corner between this curve and
nextis convex. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pointOnCurve(
double t) → ExpressivePoint -
Returns a point on the curve for parameter
t, representing the proportional distance along the curve between its starting point at anchor0 and ending point at anchor1. -
reverse(
) → ExpressiveShapeCubic - Utility function to reverse the control/anchor points for this curve.
-
split(
double t) → (ExpressiveShapeCubic, ExpressiveShapeCubic) -
Returns two Cubics, created by splitting this curve at the given
distance of
tbetween the original starting and ending anchor points. -
toString(
) → String -
A string representation of this object.
override
-
transformed(
ExpressivePointTransformer f) → ExpressiveShapeCubic -
A copy of this curve with every point moved by
f. -
zeroLength(
) → bool - Whether the two anchor points coincide.
Operators
-
operator *(
double x) → ExpressiveShapeCubic -
This curve with every coordinate multiplied by
x. -
operator +(
ExpressiveShapeCubic o) → ExpressiveShapeCubic -
This curve with
oadded to it, coordinate by coordinate. -
operator /(
double x) → ExpressiveShapeCubic -
This curve with every coordinate divided by
x. -
operator ==(
Object other) → bool -
The equality operator.
override