framer / motion

Open source, production-ready animation and gesture library for React
https://framer.com/motion
MIT License
23.32k stars 775 forks source link

[FEATURE] GSAP MorphSVGPlugin equivalent? #1392

Closed fnick851 closed 2 years ago

fnick851 commented 2 years ago

Is your feature request related to a problem? Please describe. Morphing SVG shapes on the web, without necessarily matching points.

Describe the solution you'd like A GSAP MorphSVGPlugin equivalent but declarative and for React.

Describe alternatives you've considered https://greensock.com/morphsvg/

Additional context N/A

mattgperry commented 2 years ago

We're probably not going to make this specific functionality in the near-term but here's one way you can animate morphing paths in Motion: https://codesandbox.io/s/framer-motion-morphsvg-example-dp7to?file=/src/use-flubber.ts

fnick851 commented 2 years ago

@mattgperry Just curious - do you happen to know a "best practice" way to combine the GSAP MorphSVG plugin with Motion, similar to what you did using Flubber?

You can access a demo version of the plugin in one of their Codepens: https://greensock.com/docs/v3/Plugins/MorphSVGPlugin

I'm asking because I think MorphSVG has a better algorithm which gives better interpolation result. But I couldn't find an equivalent interpolate function like Flubber.

mattgperry commented 2 years ago

I don’t know the best practise but you could try doing something like scrubbing the GSAP tween with the output of Framer Motions animate function