Bug
Animation should reset and play from the beginning each time users land on a slide. (This should cover cases for when people revisit a page)
Root cause
The slide pager uses a LazyVStack. It builds the next slide before the reader swipes to it. Rive continues to advance an off-screen view until the animation settles. So the intro of the next slide played off-screen, and the reader saw only its end state.
When the reader went back to an earlier slide, a slide that the pager kept in memory stayed on its last frame. A slide that the pager removed played again. Which slides stayed in memory depended on the scroll, so the slides that did not play again changed from test to test.
Fix:
- Only the current slide plays. All other slides stay on their first frame (WMFRiveView(isPlaying:)).
- When a slide stops being the current slide, the app makes a new state machine for it while it is off-screen. The current animation stays on screen until the new one is ready, so the slide does not go blank.