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:77
Constructors
init(_ value: T)
Not documented.
Sources/LavaUI/Animation.swift:85
Properties
var current: T { get }
Not documented.
Sources/LavaUI/Animation.swift:78
var isAnimating: Bool { get }
Not documented.
Sources/LavaUI/Animation.swift:91
var target: T { get }
Not documented.
Sources/LavaUI/Animation.swift:79
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:96
mutating func snap(to value: T)
Jumps immediately, cancelling any animation in flight.
Sources/LavaUI/Animation.swift:108
mutating func step(_ now: Double) -> Bool
Advances to now. Returns true while still animating.
Sources/LavaUI/Animation.swift:116