Morph class
An animation between two RoundedPolygon shapes.
Morphing between arbitrary objects can be problematic because it can be
difficult to determine how the points of a given shape map to the points of
some other shape. Morph simplifies the problem by only operating on
RoundedPolygon objects, which are known to have similar, contiguous
structures. For one thing, the shape of a polygon is contiguous from start
to end (compared to an arbitrary Path object, which could have one or more
moveTo operations in the shape). Also, all edges of a polygon shape are
represented by CubicBezier objects, thus the start and end shapes use similar
operations. Two Polygon shapes then only differ in the quantity and
placement of their curves. The morph works by determining how to map the
curves of the two shapes together (based on proximity and other
information, such as distance to polygon vertices and concavity), and
splitting curves when the shapes do not have the same number of curves or
when the curve placement within the shapes is very different.
- Annotations
Constructors
- Morph(RoundedPolygon start, RoundedPolygon end)
- Creates a Morph between the start and end polygons.
Properties
- end → RoundedPolygon
-
The shape this morph produces at a progress of 1.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- start → RoundedPolygon
-
The shape this morph produces at a progress of 0.
final
Methods
-
calculateApproximateBounds(
) → Rect - A cheaper alternative to calculateBounds, based on the min/max values of all anchor and control points that make up the two shapes.
-
calculateBounds(
) → Rect - Calculates the axis-aligned bounds of this morph, covering both of its shapes.
-
calculateMaxBounds(
) → Rect - Like calculateBounds, calculates the axis-aligned bounds of this morph, but determines the max dimension of the shapes (by calculating the distance from their center to the start and midpoint of each curve) and returns a square which can be used to hold the morph in any rotation.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toCubics(
double progress) → List< CubicBezier> -
Returns this morph's shape at
progressas a list of CubicBeziers. -
toPath(
double progress, {double startAngle = 0.0, bool repeatPath = false, bool closePath = true, Offset rotationPivot = .zero, Path? path}) → Path -
Returns a Path for this morph's shape at
progress. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override