Morph submobject families and add fill_mode subpath balancing - #6
Merged
Conversation
Polymorph previously rejected any mobject whose points live in submobjects, which ruled out Text, Tex, VGroups, and SVG imports. Since polymorph aligns arbitrary numbers of subpaths natively, flatten each keyframe's family into one multi-subpath path instead: - collect subpaths per family member in draw order, so boundaries stay exact even when one member's path ends where the next begins - collapse the animated mobject to a single flat VMobject during the morph, styled after its first drawn family member; style crossfade interpolates between those representative members rather than the (styleless) parents - restore the target's full submobject structure on finish with snap_to_target, so Text/Tex targets end as real glyphs Flattened text exposes how subpath-count mismatches are filled: with polymorph's origin-point padding, four letters of a five-letter word grow from nothing while only one morphs from the source shape. Add a fill_mode option to control this. The new default, share, clones the smaller keyframe's subpaths (cycling largest-perimeter first) so every subpath morphs from and to real geometry — one shape splits into every glyph of a word, and every glyph merges back into one shape. The previous behavior remains as fill_mode=grow, used explicitly by the demo's origin-growth showcase. Per-submobject styling collapses to one style mid-morph; documented in the README limitations.
pjfo
added a commit
that referenced
this pull request
Aug 2, 2026
Morph submobject families and add fill_mode subpath balancing
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.
Polymorph previously rejected any mobject whose points live in submobjects, which ruled out Text, Tex, VGroups, and SVG imports. Since polymorph aligns arbitrary numbers of subpaths natively, flatten each keyframe's family into one multi-subpath path instead:
Flattened text exposes how subpath-count mismatches are filled: with polymorph's origin-point padding, four letters of a five-letter word grow from nothing while only one morphs from the source shape. Add a fill_mode option to control this. The new default, share, clones the smaller keyframe's subpaths (cycling largest-perimeter first) so every subpath morphs from and to real geometry — one shape splits into every glyph of a word, and every glyph merges back into one shape. The previous behavior remains as fill_mode=grow, used explicitly by the demo's origin-growth showcase.
Per-submobject styling collapses to one style mid-morph; documented in the README limitations.