LavaUI docs GitHub

struct SpatialAnimation

Swift

struct SpatialAnimation

How a 3D object moves to a new transform.

Attach with .animation3D(_:). Without one, a changed transform takes effect in the next frame.

Sources/LavaUI/Spatial.swift:167

Constructors

init(duration: Double = 0.22, curve: AnimationCurve = .easeOut, animatesPosition: Bool = true)

Creates an animation.

Sources/LavaUI/Spatial.swift:178

Properties

var animatesPosition: Bool

When false, world x jumps to the new pose and only y/z, rotation, and scale interpolate. A bookshelf can keep the focused cover planted at the camera centre instead of sliding the whole shelf.

Sources/LavaUI/Spatial.swift:175

var curve: AnimationCurve

How progress maps onto time.

Sources/LavaUI/Spatial.swift:171

var duration: Double

How long the move takes, in seconds.

Sources/LavaUI/Spatial.swift:169

Methods

static func smooth(duration: Double = 0.22, curve: AnimationCurve = .easeOut) -> SpatialAnimation

An eased transition of duration seconds.

Sources/LavaUI/Spatial.swift:195

func snappingPosition() -> SpatialAnimation

Position.x jumps; lift, turn, and scale still ease.

Sources/LavaUI/Spatial.swift:188

static func spring(response: Double = 0.32, dampingFraction: Double = 0.72) -> SpatialAnimation

A physically shaped hover/selection transition. response controls how quickly the spring reacts; dampingFraction controls its bounce.

Sources/LavaUI/Spatial.swift:203