NodeAnimation class final

One AnimationController on a node and the tweens it drives (behavior key animations, a list). A screen-wide one sits on the canvas node.

Its value runs 0 → 1 over duration (back over reverseDuration), after delay, eased by curve (CurvedAnimation), repeated or once; on a spring instead of the clock; or follows progress (an expression) with no clock at all. Each track maps that value to its property (AnimationTrack).

preset names a short form (pulse, shake, spin... see AnimationPresets) whose tracks and timing it stands for, with params; fields given here override the preset's (expanded).

Read as ${animation.<id>.value} (after curve), .status (dismissed, forward, reverse, completed) and .isAnimating by the node and the nodes inside it; driven by the animate action.

Annotations
  • @immutable

Constructors

NodeAnimation({required String id, String? preset, Json params = const {}, bool enabled = true, int? duration, int? reverseDuration, int delay = 0, AnimationCurve? curve, AnimationRepeat? repeat, bool? autoplay, String? playKey, bool paused = false, double phase = 0, Spring? spring, String? progress, Alignment? alignment, List<AnimationTrack> tracks = const [], double? previewAt, int ramp = 0, double? visibleFraction})
const

Properties

alignment → Alignment?
The point the scale and rotation of its adding and multiplying tracks are about (ScaleTransition(alignment:)); null: the preset's, else the center.
final
autoplay → bool?
Plays when the node appears; false waits for playKey or an action. Null: the preset's, else true.
final
autoplays → bool
no setter
curve → AnimationCurve?
Applied to the controller's value before every track; null: the preset's, else linear.
final
cycleMs → int
One cycle in ms: a run, or a run there and back.
no setter
delay → int
Waits this long (ms) before each play starts; the value holds at its start meanwhile.
final
duration → int?
AnimationController.duration / reverseDuration (ms); null: the preset's, else 300.
final
durationMs → int
no setter
effectiveAlignment → Alignment
no setter
effectiveCurve → AnimationCurve
no setter
enabled → bool
Off, it applies nothing and doesn't run (the node shows its own values). Bindable.
final
expanded → NodeAnimation
The primitive form: preset expanded into tracks and timing, this animation's own fields over the preset's. Itself without a preset (or with one AnimationPresets doesn't know).
no setter
hashCode → int
The hash code for this object.
no setterinherited
id → String
Unique on the node: ${animation.<id>.*}, the animate action's animation, and the key a binding addresses it by (animations.<id>.paused). JSON reads name too. Empty: it plays, but nothing can name it.
final
params → Json
final
paused → bool
Holds the controller where it is (stop()) while true; it carries on when false. Held before it starts, it waits at its start. Bindable.
final
phase → double
Where a play starts, as a share (0–1) of one cycle: forward(from: phase); a run there and back when repeat reverses. Bindable (${= index / count} staggers copies).
final
playKey → String?
A change of this value to one that isn't empty, 0, false or null plays it from the start (forward(from: 0)); not when the node first shows. Bindable.
final
preset → String?
final
previewAt → double?
Where the design canvas draws it, as a share of one cycle after its phase; null: not applied there (the node shows its own values, which is an entrance's end). Null takes the preset's.
final
progress → String?
An expression giving the value (0–1) directly: ${view.progress}, a variable. The animation then has no clock (spring, when set, eases toward each new value).
final
props → List<Object?>
no setter
ramp → int
A repeating animation speeds up from still to its full pace over this many ms when it starts or resumes, slows to a stop over it when paused, and eases to a new pace when its duration changes (a fan, a turntable spinning up). 0: at once, as repeat() does.
final
repeat → AnimationRepeat?
repeat(reverse:, count:); null: the preset's, else plays once.
final
repeats → bool
Whether it repeats (forever or a count).
no setter
reverseDuration → int?
AnimationController.duration / reverseDuration (ms); null: the preset's, else 300.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
spring → Spring?
Runs on this spring instead of duration and curve: animateWith(SpringSimulation(spring, 0, 1, 0)).
final
tracks → List<AnimationTrack>
final
visibleFraction → double?
With it, an autoplaying animation waits until this share (0–1) of the node is visible in its view before it starts (a scroll reveal: the share a enterViewport trigger's visibleFraction counts). Null: it starts when the node appears.
final

Methods

copyWith({bool? enabled, int? duration, AnimationRepeat? repeat, bool? autoplay, String? playKey, double? phase, List<AnimationTrack>? tracks, double? previewAt, bool? paused}) → NodeAnimation
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Json
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

fromJson(Object? json) → NodeAnimation?

Constants

key → const String
The JSON key on a node.