Lottie grandchild fix v2 - #2802
Open
MarkYav wants to merge 6 commits into
Open
Conversation
…ent layer is not rendered.
Replaced the shallow parent mapping with a topological traversal algorithm (buildAncestorTransforms) to accurately capture the entire hierarchy of ancestral transforms for each layer. Previously, Lottie layers completely discarded transforms generated past their immediate parent, breaking deep Lottie hierarchies. Providing the entire ancestral lineage as a sequential list natively preserves the top-down cascading render sequence, letting the RemoteCanvas apply each layer's intrinsic rotation, translation, and custom anchor points accurately. Additionally, wrapped the heavy hierarchical list allocations in a remember(animation.layers) block in LottieAnimation to prevent Garbage Collection churn and performance lags during recompositions.
yschimke
reviewed
Aug 17, 2026
yschimke
reviewed
Aug 17, 2026
yschimke
reviewed
Aug 17, 2026
| } | ||
| } | ||
|
|
||
| composeRule.onNodeWithTag("Box").captureRoboImage(testName("_grandparent")) |
Collaborator
There was a problem hiding this comment.
It's hard from the test to reason about whether it's right or wrong. Can we either describe how to tell if it's working.
or alternatively, is there a way to make the image tell a story. Such as each layer being a some item like a circle with a number, and the transforms make each layer move out of the way, but without the grandparent, you won't see all 3?
1. Red Square (Root layer): Drawn in the top-left at [0, 0]. 2. Blue Square (Parent layer): Shifts its local child to the top-right at [96, 0]. 3. Green Square (Child layer): Shifts its local child down by [0, 96]. Because the Green Square is a child of the blue square, it inherits the [96, 0] translation and applies its own [0, 96] translation. This means if the Lottie engine correctly parses all 3 tiers of the hierarchy, the Green Square correctly lands in the bottom-right corner. If the bug was still present (where it ignorantly dropped the grandparent's transform), the Green Square would wrongly render in the bottom-left corner.
yschimke
reviewed
Aug 18, 2026
| } | ||
| } | ||
|
|
||
| private fun buildAncestorTransforms(layers: List<Layer>): Map<Int, List<Transform>> { |
Collaborator
There was a problem hiding this comment.
After we land this, I might see if we can implement this as nested transforms, which is closer to the Compose way.
But not blocking for now.
yschimke
approved these changes
Aug 18, 2026
yschimke
left a comment
Collaborator
There was a problem hiding this comment.
After fixing the screenshot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Fix for #2795
WHAT
WHY
HOW
Checklist 📋