How does messages implement rubbery momentum physics-based scrolling behavior of speech bubbles?

Generated on 7/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".