How does messages implement rubbery momentum physics-based scrolling behavior of speech bubbles?
Asked on 07/31/2024
1 search
Messages implements rubbery momentum physics-based scrolling behavior of speech bubbles using continuous velocity in animations. This is achieved through the use of interactive spring animations that preserve the velocity at the end of a gesture.
When a gesture, such as a pan, is performed, the gesture continuously fires change events as the finger moves. Each of these events creates a new interactive spring animation, which retargets the last one. When the gesture ends, a final non-interactive spring animation is created. This final spring uses the velocity from the interactive springs to carry the animation forward with continuous velocity, creating a smooth and natural scrolling effect.
For more details, you can refer to the session Enhance your UI animations and transitions at the chapter "Gesture-driven animations".

Enhance your UI animations and transitions
Explore how to adopt the zoom transition in navigation and presentations to increase the sense of continuity in your app, and learn how to animate UIKit views with SwiftUI animations to make it easier to build animations that feel continuous.

Create custom visual effects with SwiftUI
Discover how to create stunning visual effects in SwiftUI. Learn to build unique scroll effects, rich color treatments, and custom transitions. We’ll also explore advanced graphic effects using Metal shaders and custom text rendering.

Discover RealityKit APIs for iOS, macOS and visionOS
Learn how new cross-platform APIs in RealityKit can help you build immersive apps for iOS, macOS, and visionOS. Check out the new hover effects, lights and shadows, and portal crossing features, and view them in action through real examples.