Jump to content
Search Community

Morph two SVG's

Tech Nomad test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hey Guys, 

I need to animate a bouncing transition of two states of an SVG logo. But struggle to find a solution. It seems there is no native CSS transform function like the "envelope distort ---> make with Warp" function in Illustrator CC. I found out you can morph paths with snap.svg but my Logo consist of multiple paths which I want animate synchronously / all together. 

Do you maybe know what I have to look for? 

 

Thank you in advance.

 

These are the two states I have to animate: 

 

Screenshot 2018-12-28 at 13.10.38.png

Link to comment
Share on other sites

Hi @Tech Nomad :)

 

Welcome to the forum.

 

If you want to use the morphSVG plugin for this, you need to have a start and end target path for each morph. You can take advantage of loops to make your life easier. Here's a basic example with three paths. 

 

See the Pen QzqdKN by PointC (@PointC) on CodePen

 

You'd just add any ease you like for that effect. You can also give each path a unique ID and loop through like this:

 

See the Pen LNLpgB by PointC (@PointC) on CodePen

 

The morph plugin is a Club GreenSock perk. More info about that here:

https://greensock.com/club

 

Hopefully that gets you started. Happy tweening and welcome aboard.

:)

 

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

Yep, as the others have suggested, MorphSVGPlugin should make this very doable. Most other tools like Snap.svg don't handle shapes with different numbers of points in them. And we did a ton of work in MorphSVGPlugin to make sure it delivers an intuitive morph between the two shapes (well, as much as a computer algorithm can realistically do). I've included an example below. 

 

Just make sure that you combine things into ONE path. So you'd have one for the "starting" shape, and then another for the "ending" shape, and then just have morphSVG interpolate between them for you. 

 

Happy tweening!

morph-comparison.gif

  • Like 3
Link to comment
Share on other sites

Wow, thank you for so many replies! :)

I got this working with the Craigs idea to loop through all the paths. But I still have used snap.svg ? 

I currently can't effort to spent 150$ to just for animating the logo ? Or is it actually only 99$ if I use it for my private but still commercial app? 
But one day I will purchase the membership anyway as I use TweenMax quite often also for the app itself outside the logo animation. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...