cashapp / paparazzi

Render your Android screens without a physical device or emulator
https://cashapp.github.io/paparazzi/
Apache License 2.0
2.31k stars 215 forks source link

Proposed fix to correct Compose UI animations #1645

Open geoff-powell opened 1 month ago

geoff-powell commented 1 month ago

So animations with offsetMillis didn't work properly in paparazzi. This was due to the Transition apis tracking the startTimeNanos when a transition starts. Since this is set ahead of the transition, the delta to render the frame was always 0. For gif() methods that used start = 0 they render correctly because the starting frame is at 0 nanos.

The best way I could combat this was for cases in Compose where the caller was manually setting the startNanos for Paparazzi.takeSnapshots() I call multiple render calls with time 0 to ensure Transition apis have startTimeNanos = 0

Fixes #627 #678