Interface AnimationPhase

Animation phase. Rules (applied to both show and hide):

  • Unique target property. At most one tween per (target node, property) pair in a phase. A second one is a load-time error.
  • Target must exist. target must resolve to a node id in the tree at load time, otherwise the overlay fails to register.
  • Empty tween is a no-op. A tween with neither explicit from nor to and whose implicit values coincide silently does nothing.
  • duration: 0 is allowed. Instant snap to to at delay time; property then stays at to for the rest of the phase.
  • Settle to base on phase end. When the phase finishes, every tweened property snaps to the node's declared base value from OverlayDefinition - even if the tween's explicit to was different. The base value (mutated by patch()) is the canonical resting state; to is only a trajectory target during the phase.
  • Patch during phase. Calls to patch() that land while a tween is in flight do not retarget the tween - neither its explicit nor implicit to is re-resolved. The patched base takes effect at the phase-end settle (see above) and on the next phase.
interface AnimationPhase {
    duration: AbsoluteDuration;
    onComplete?: ((reason) => void);
    tweens: Tween[];
}

Properties

Total length of the phase. Relative tweens are fractions of this.

onComplete?: ((reason) => void)

Called when the phase's animation ends. The argument reports how it ended - "show", "hide", or "interrupted" (see AnimationEnd). Because an omitted hide replays the show phase backwards, a show phase's onComplete fires with "hide" when that reverse finishes, and with "interrupted" if a show is cut short by a hide (then again when the hide ends).

Type declaration

tweens: Tween[]