LavaUI docs GitHub

struct Transition

Swift

struct Transition

How a view animates as it appears and disappears.

Value animation (Animated<T>) covers a property changing on a node that stays put. A transition is the other half: the node itself arriving or leaving. Leaving is the hard direction — by the time a reconciler knows a child is gone, the view describing it no longer exists, so the node has to outlive its own removal. That is what FragmentNode.departingChildren is for, and it is why this touches the three reconcilers that drop nodes rather than living entirely in a modifier.

Sources/LavaUI/Transition.swift:12

Constructors

init(fades: Bool = true, offsetX: Float = 0, offsetY: Float = 0, duration: Double = 0.18, curve: AnimationCurve = .easeOut)

Creates a transition. The default is a short fade.

Sources/LavaUI/Transition.swift:25

Properties

var curve: AnimationCurve

How progress maps onto time.

Sources/LavaUI/Transition.swift:22

var duration: Double

How long the arrival or departure takes, in seconds.

Sources/LavaUI/Transition.swift:20

var fades: Bool

Fade between transparent and opaque.

Sources/LavaUI/Transition.swift:14

var offsetX: Float

Where the view comes from and returns to, relative to its final place.

Sources/LavaUI/Transition.swift:16

var offsetY: Float

Vertical offset the view comes from and returns to. See offsetX.

Sources/LavaUI/Transition.swift:18

static let opacity: Transition

A plain fade, with no movement.

Sources/LavaUI/Transition.swift:40

Methods

static func slide(dx: Float = 0, dy: Float = -8) -> Transition

Slides in from dy above (negative) or below (positive), fading.

Sources/LavaUI/Transition.swift:43