feat(morph-loader): add twelve more Material 3 expressive shapes - #50
Open
dennytosp wants to merge 1 commit into
Open
feat(morph-loader): add twelve more Material 3 expressive shapes#50dennytosp wants to merge 1 commit into
dennytosp wants to merge 1 commit into
Conversation
Adds `6-sided-cookie`, `9-sided-cookie`, `12-sided-cookie`, `sunny`, `burst`, `clover-4`, `clover-8`, `flower`, `triangle`, `diamond`, `square` and `gem` to `SHAPES`, taking the set from 7 to 19. They are written as SVG path strings rather than point lists — the existing `prepareShape` already accepts either — which keeps them readable and lets Skia flatten them at the resolution the loader actually samples. Each new shape is wound the same way as the shipped ones and starts at the top, so morphing between any pair interpolates point-for-point instead of twisting through a collapsed midpoint. `defaultShapes` now reads from an explicit `DEFAULT_SHAPE_KEYS` list rather than every key in `SHAPES`, so a loader with no `shapes` prop cycles through exactly what it did before. Closes rit3zh#43
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.
Closes #43
Adds
6-sided-cookie,9-sided-cookie,12-sided-cookie,sunny,burst,clover-4,clover-8,flower,triangle,diamond,squareandgem, takingSHAPESfrom 7 to 19.Grey = already shipped, purple = new. Every shape below is rendered through the component's own pipeline (
prepareShape→ 80-point resample → straight-line polygon), so this is what the loader actually draws:Notes
Written as SVG paths.
prepareShapealready accepts either a point list or a path string, and takes the SVG branch throughflattenSvgPath. Authoring the new shapes as paths keeps them readable instead of adding ~600 numbers each, and lets Skia flatten them at exactly the resolution the loader samples.Wound to match. All seven shipped shapes have a negative signed area and start near the top. Morphing interpolates point k of shape A to point k of shape B, so a shape wound the other way collapses through a degenerate midpoint. The new shapes follow the same convention — this was worth getting right, since it is invisible in a static render and only shows up mid-morph.
Defaults are unchanged.
defaultShapesused to beObject.values({ ...SHAPES }), so adding any shape would have silently changed what an existing<MorphLoader />renders. It now reads an explicitDEFAULT_SHAPE_KEYSlist holding the original seven in their original order.Verification
defaultShapesis byte-identical tomain— an existing loader with noshapesprop cycles through exactly what it did before.NaN, and the worst area retention is 82.2% (4-sided-cookie → square). A mis-wound shape shows up here as a near-zero retention.prepareShape; the 7 originals still take the point-list branch.tsc --noEmitreports the same error count asmain(none in these files).Sample morphs, shipped → new:
Open question
I kept the default rotation at the original seven so nothing changes for existing users. If you would rather the defaults cycle through more of the set, that is a one-line change to
DEFAULT_SHAPE_KEYS— happy to adjust.