LavaUI docs

enum AnimationDriver

Swift

enum AnimationDriver

Steps every node with animation in flight, once per frame.

A registry rather than a tree walk: only animating nodes are visited, so an idle window does no work at all and a single animating button does not cost a traversal of the whole tree.

Sources/LavaUI/Animation.swift:178

Properties

static var isAnimating: Bool { get }

Not documented.

Sources/LavaUI/Animation.swift:212

Methods

static func register(_ id: NodeID, step: @escaping () -> Bool)

Not documented.

Sources/LavaUI/Animation.swift:192

static func requestRevisibilityCheck()

Call once after a frame has emitted, i.e. after NodeVisibility was just refreshed. tick() reads visibility captured before that same frame's emitTree — one iteration stale by design — so a node whose box just scrolled, resized, or expanded into view has no wake queued yet: the tick() earlier this same iteration still saw it as off-screen and correctly asked for nothing. Without this, such a node stays frozen until some unrelated input happens to wake the loop, rather than resuming on its own next frame. A no-op once nothing is registered, and otherwise just re-arms the same 60fps wake tick() would have asked for had it seen current visibility — it does not step or mark redraw itself, so an actually-still-invisible node costs nothing beyond one harmless extra wake that tick() immediately suppresses again.

Sources/LavaUI/Animation.swift:227

static func tick()

Advances every registered animation. Everything still gets stepped — cheap, and it is what lets a [weak self] stepper on a since-deallocated node reap itself out of active even while its node was invisible — but only a visible node's progress justifies a redraw and another 60fps wake. A Canvas(continuousRedraw: true) scrolled out of view, or collapsed behind an Expand, otherwise never stops asking for one: its own stepper has no notion of "am I on screen", only of the state the widget handed it (playing/not playing). A minimized window's registrants are stepped but never counted as visible, which is the per-window form of the gate the frame loop used to apply to tick() as a whole. That gate could only say "no window is visible"; with two windows it would have let a minimized one keep asking for 60fps as long as the other was up.

Sources/LavaUI/Animation.swift:245

static func unregister(_ id: NodeID)

Not documented.

Sources/LavaUI/Animation.swift:203