struct Animated
Swift
struct Animated<T> where T : Animatable
A property that moves toward a target over time.
Lives on the node, not in a view. Views are rebuilt every frame and
carry no identity; nodes persist, already own visual state like fillColor
and scrollOffset, and can therefore interpolate without re-running a
single body. Driving animation from the view side would recompute the
whole tree — Mirror-based state transplant included — sixty times a second
to change a colour.
Sources/LavaUI/Animation.swift:86
Constructors
init(_ value: T)
Starts at rest on value.
Sources/LavaUI/Animation.swift:97
Properties
var current: T { get }
The value to draw this frame.
Sources/LavaUI/Animation.swift:88
var isAnimating: Bool { get }
Whether an animation is in flight.
Sources/LavaUI/Animation.swift:104
var target: T { get }
The value being animated toward; equal to current once the animation settles.
Sources/LavaUI/Animation.swift:90
Methods
mutating func animate(to value: T, duration seconds: Double = 0.12, curve: AnimationCurve = .easeOut)
Starts moving toward value. Retargeting mid-flight restarts from
wherever the value currently is, so an interrupted animation continues
smoothly rather than jumping back to its original start.
Sources/LavaUI/Animation.swift:109
mutating func snap(to value: T)
Jumps immediately, cancelling any animation in flight.
Sources/LavaUI/Animation.swift:121
mutating func step(_ now: Double) -> Bool
Advances to now. Returns true while still animating.
Sources/LavaUI/Animation.swift:129