Skip to content

feat(registry): add SVG Morph component#80

Open
alejopequeno wants to merge 5 commits intomainfrom
alejo/svg-morph
Open

feat(registry): add SVG Morph component#80
alejopequeno wants to merge 5 commits intomainfrom
alejo/svg-morph

Conversation

@alejopequeno
Copy link
Contributor

@alejopequeno alejopequeno commented Feb 13, 2026

Result

New svg-morph registry component that morphs SVG path d attributes with auto-looping. Supports multiple morph slots (each cycling through its own path states), static paths for compound shapes, and a transform prop for coordinate system conversion.

  • Component: registry/joyco/blocks/svg-morph.tsx — uses flubber for path interpolation + Motion for animation
  • Demo: Animated face with morphing eyes and mouth (3 expression states)
  • Docs: Full props table, usage example, auto-looping explanation, and limitations section

Install via:

npx shadcn@latest add @joyco/svg-morph

Dependencies added automatically: flubber, motion.

Media

Screen.Recording.2026-02-12.at.11.24.49.PM.mov

Greptile Overview

Greptile Summary

Adds a new svg-morph component that smoothly animates between SVG path states using flubber interpolation and Motion animation. The implementation supports both auto-looping mode (cycles through states automatically) and controlled mode (programmatically jump to specific steps).

  • Clean separation between AutoMorphPath and ControlledMorphPath components
  • Proper memoization in place (previous review comments addressed)
  • Well-documented with comprehensive props tables and usage examples
  • Includes both auto-loop and controlled demos showing face expressions
  • useSvgMorph hook provides intuitive step navigation with boundary checks
  • Dependencies (flubber, motion) properly added to package.json

Confidence Score: 5/5

  • Safe to merge with no blocking issues
  • Well-structured component with proper React hooks usage, comprehensive documentation, and working demos; previous feedback addressed
  • No files require special attention

Important Files Changed

Filename Overview
registry/joyco/blocks/svg-morph.tsx New SVG morphing component with auto-loop and controlled modes; previous comments addressed with memoization
hooks/use-svg-morph.ts Clean step control hook with proper memoization and clamping logic
demos/svg-morph-demo.tsx Auto-loop demo showing animated face with morphing features
demos/svg-morph-controlled-demo.tsx Controlled mode demo with step navigation and proper accessibility labels
content/components/svg-morph.mdx Comprehensive docs with props tables, examples, and clear limitations section

Last reviewed commit: 3d93fba

@vercel
Copy link
Contributor

vercel bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
joyco-hub Ready Ready Preview, Comment Feb 13, 2026 8:57pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Import useMemo and cache loopedPaths and indices to avoid recreating
arrays on every render. Update the effect to depend on the memoized
loopedPaths so animations update reliably when paths change.
Implement a step prop that switches the component to controlled
mode and animates directly to the target step (preserving mid-
animation state). Add a useSvgMorph hook to manage step state
(setStep/next/prev/isFirst/isLast), include a controlled demo, and
update docs and registry metadata to advertise the new mode and hook.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant