TransformAct class

Animates arbitrary 3D transformations using Matrix4.

TransformAct applies 2D and 3D transformations to widgets by animating a Matrix4. This provides low-level control for complex transformations that can't be achieved with other acts like scale, rotate, or translate.

Use Act.transform() factory to create instances.

Basic Matrix Transform

// Animate a custom matrix transformation
Actor(
  acts: [
    .transform(
      from: Matrix4.identity(),
      to: Matrix4.diagonal4Values(1.2, 1.2, 1, 1),
    ),
  ],
  motion: .smooth(damping: 23),
  child: MyWidget(),
)

Transform with Alignment

// Apply transformation from a specific point
Actor(
  acts: [
    .transform(
      to: Matrix4.rotationZ(0.5),
      alignment: Alignment.center,
    ),
  ],
  motion: .smooth(damping: 23),
  child: MyWidget(),
)

Transform with Origin Offset

// Apply transformation relative to a specific origin
Actor(
  acts: [
    .transform(
      to: Matrix4.skew(0.1, 0),
      origin: Offset(50, 50),
    ),
  ],
  motion: .smooth(damping: 23),
  child: MyWidget(),
)
Inheritance

Constructors

TransformAct({Matrix4? from, required Matrix4 to, CueMotion? motion, ReverseBehavior<Matrix4> reverse = const ReverseBehavior.mirror(), AlignmentGeometry? alignment, Offset? origin, Duration delay = Duration.zero})
Creates a TransformAct with optional from/to matrix values.
TransformAct.keyframed({required Keyframes<Matrix4> frames, KFReverseBehavior<Matrix4> reverse = const KFReverseBehavior.mirror(), AlignmentGeometry? alignment, Offset? origin, Duration delay = Duration.zero})
Animates through multiple matrix transformation keyframes.

Properties

alignment → AlignmentGeometry?
The alignment of the transformation origin.
final
delay → Duration
Delay before this act's forward animation starts.
finalinherited
frames → Keyframes<Matrix4>?
Keyframes for this act (keyframed mode only).
finalinherited
from → Matrix4?
The initial animated value for this tween.
finalinherited
hashCode → int
The hash code for this object.
no setteroverride
isConstant → bool
Whether this tween is a no-op (from == to).
no setterinherited
key → ActKey
Animates between two matrix transformations.
final
motion → CueMotion?
Per-act motion override. When non-null, replaces the motion inherited from Actor or Cue for this act only.
finalinherited
origin → Offset?
The origin of the transformation (offset from center).
final
reverse → ReverseBehaviorBase<Matrix4>
Reverse behavior for this act — controls what happens when the animation plays in reverse.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
to → Matrix4?
The final animated value for this tween (tween mode only).
finalinherited

Methods

apply(BuildContext context, covariant Animation<Matrix4> animation, Widget child) → Widget
Applies the animated value to child and returns the resulting widget.
applyInternal(BuildContext context, covariant CueAnimation<Object?> animation, Widget child) → Widget
Delegates to apply after asserting that animation has the expected type CueAnimation<R>.
inherited
buildAnimation(CueTimeline timline, ActContext context) → CueAnimation<Matrix4>
Builds and registers the animation tracks on timline, returning a CueAnimation that provides the current animated value at each frame.
inherited
buildAnimtable(ActContext context) → CueAnimtable<Matrix4>
Assembles the forward and reverse animatables into a single CueAnimtable, wrapping them in a DualAnimatable when a separate reverse animatable is present.
inherited
buildTweens(ActContext context) → (CueAnimtable<Matrix4>, CueAnimtable<Matrix4>?)
Implements the core reverse behavior logic for tween and keyframed acts.
inherited
createSingleTween(Matrix4 from, Matrix4 to) → Animatable<Matrix4>
Creates a single Animatable from from to to values.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(ActContext context) → ActContext
Resolves the final ActContext for this act by calling resolveMotion.
inherited
resolveTween(ActContext context, {required Matrix4? from, required Matrix4? to, Matrix4? iniitalkeyframe, Matrix4? implicitFrom, bool forReverse = false, required Keyframes<Matrix4>? keyframes}) → CueAnimtable<Matrix4>
Builds a CueAnimtable from tween or keyframe values.
inherited
toString() → String
A string representation of this object.
inherited
transform(ActContext _, Matrix4 value) → Matrix4
Identity transform — returns the input value unchanged.
inherited

Operators

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