google / automotive-design-compose

Automotive Design for Compose is an extension to Jetpack Compose that allows every screen, component, and overlay of your Android App to be defined in Figma, and lets you see the latest changes to your Figma design in your app, immediately!
https://google.github.io/automotive-design-compose/
Apache License 2.0
101 stars 14 forks source link

Fix #1052: rewrite squoosh animation tree building to not mutate trees. #1053

Open iamralpht opened 2 weeks ago

iamralpht commented 2 weeks ago

While attempting to fix a bug in squoosh's animation support where the root frames of components were not considered for animation, I kept running into layout assertions, which ultimately were because the animation implementation performs destructive mutations on the base layout tree AND on the "transition layout tree".

This change means that all SquooshResolvedNode trees are now immutable after construction (except for layout and style values which can change after the tree was built).

Finally, because the source trees are immutable, we can run layout on the root and target root trees whenever layout needs to change. This means animations are uninterrupted by relayouts, and we can relayout as many times as we like without generating new trees.

github-actions[bot] commented 2 weeks ago
Snapshot diff report vs base branch: main Last updated: Sun Apr 28 13:32:45 PDT 2024, Sha: 16dfc3aa67ea0f5a76f15104c1dfc0bb244d44af File name Image
VariantAnimation-Mid
Point_compare.png