cashapp / paparazzi

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

Compose delay for animation effect #678

Open eugene-bes opened 1 year ago

eugene-bes commented 1 year ago

Hi. I have compose widget with animation effect. This animation has a duration about 500ms. How can I add delay 500ms before the paparazzi takes a screenshot?

jisungbin commented 1 year ago

Maybe duplicate of https://github.com/cashapp/paparazzi/issues/627.

eugene-bes commented 1 year ago

@jisungbin I expected this to work but it doesn't :(

leo-beliakov commented 3 months ago

@jrodbx Any updates on this?

geoff-powell commented 3 weeks ago

Update here, unfortunately AndroidX Compose Animations track the animation start time to animate state. As such, paparazzi jumps to the offsetMillis passed in snapshot/gif methods. This makes snapshots at the given offset not represent the actual state as the start time becomes the offsetMillis passed.

Fixes:

  1. Request an issue on IssueTracker to add a way in AndroidX compose animations to restrict this start time logic for our usecase.
  2. When snapshoting something with an offsetMillis > 0, requiring the initial render for the 0 frame to track the correct animation timing with startTime = 0 in compose animation.

I am leaning toward 2 as it unblocks us. It does require an additional render but I think this is okay as it should only effect snapshots/gifs with offset > 0