CubicBezier class

A single cubic Bézier curve.

The curve runs from anchor0 to anchor1, and the control points control0 and control1 determine its slope at either end.

Annotations

Constructors

CubicBezier(Offset anchor0, Offset control0, Offset control1, Offset anchor1)
Creates a cubic Bézier curve running from anchor0 to anchor1, with control0 and control1 determining its slope at either end.
CubicBezier.circularArc(Offset center, Offset p0, Offset p1)
Generates a bezier curve that approximates a circular arc around center, 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 center.
factory
CubicBezier.point(Offset point)
Generates a zero-length CubicBezier at point.
CubicBezier.straightLine(Offset p0, Offset p1)
Generates a bezier curve that is a straight line between the given anchor points p0 and p1. The control points lie 1/3 of the distance from their respective anchor points.
factory

Properties

anchor0 → Offset
The anchor point at the start of the curve.
no setter
anchor0X → double
The X coordinate of the anchor point at the start of the curve.
final
anchor0Y → double
The Y coordinate of the anchor point at the start of the curve.
final
anchor1 → Offset
The anchor point at the end of the curve.
no setter
anchor1X → double
The X coordinate of the anchor point at the end of the curve.
final
anchor1Y → double
The Y coordinate of the anchor point at the end of the curve.
final
control0 → Offset
The control point closest to anchor0.
no setter
control0X → double
The X coordinate of the control point closest to anchor0.
final
control0Y → double
The Y coordinate of the control point closest to anchor0.
final
control1 → Offset
The control point closest to anchor1.
no setter
control1X → double
The X coordinate of the control point closest to anchor1.
final
control1Y → double
The Y coordinate of the control point closest to anchor1.
final
hashCode → int
The hash code for this object.
no setteroverride
isZeroLength → bool
Whether this curve's two anchor points coincide, and so the curve contributes nothing to an outline.
no setter
reversed → CubicBezier
This curve with its control and anchor points in reverse order, so it runs from anchor1 to anchor0.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

calculateApproximateBounds() → Rect
A cheaper alternative to calculateBounds, which bounds the two anchor points and the two control points rather than solving for the curve's actual extrema.
calculateBounds() → Rect
Calculates the axis-aligned bounding box of this curve.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pointAt(double t) → Offset
Returns the point on this curve at t, the proportional distance along the curve from anchor0 at 0 to anchor1 at 1.
pointAtX(double t) → double
The X coordinate of the point on this curve at t. See pointAt.
pointAtY(double t) → double
The Y coordinate of the point on this curve at t. See pointAt.
split(double t) → (CubicBezier, CubicBezier)
Returns two CubicBeziers, created by splitting this curve at the given distance of t between the original starting and ending anchor points.
toString() → String
A string representation of this object.
override
transformed(ShapePointTransformer transformer) → CubicBezier
Returns a copy of this curve with transformer applied to each of its anchor and control points.

Operators

operator ==(Object other) → bool
The equality operator.
override