📦Animation
SwiftUI ⟩ animations ⟩ Animation (struct
)
👉 Sec. 5: Compose Animations for Complex Effects - Step 3.
extension Animation {
/// `Animation.ripple()`
/// - Returns: `Animation`
static func ripple() -> Animation {
Animation
/// ⭐️ a reduced damping fraction makes the views hop.
.spring(dampingFraction: 0.5)
/// ⭐️ speed up the animation, to shorten the time
/// it takes to move to its new position.
.speed(2)
/// ⭐️ add a delay to each animation based on
/// the view's `index` on the graph.
.delay(0.03 * Double(index))
}
}
MyView().animation(.ripple())
SwiftUI Tutorials ⟩ Animating Views & Transitions ⟩
SwiftUI ⟩
Animation (struct)
Animatable (protocol) - describes how to animate a property of a view
View ⟩ Graphics and Rendering ⟩
.animation(_:) - applied to equatable view
.animation(_:value:) - applied to equatable value (non-equatable view)
Last updated
Was this helpful?