Jump to content
GreenSock

gotaquestion

morphing multiple polygons in one svg path

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

in this example, I have  two polygons that morph over time. and morphsvg works great when each individual polygon path is defined in the svg 

Here is a working example that uses 4 paths in the svg

 

 

However, I have many many years of data to deal with, and I'd to save time and combine the individual polygon paths per year, so I only have one div per year to deal with. but can morphsvg morph separate polygons defined in one path?

Here is an example of the same paths above but combined per year

See the Pen NdNmPg by anon (@anon) on CodePen

but nothing shows up.

See the Pen RKadzP by anon (@anon) on CodePen

Link to comment
Share on other sites

Hi gotaquestion  :)

 

Nothing is showing up in your 2nd demo because you have your #March_2010 path visibility set to hidden in your CSS.

 

I'm not sure I completely understand your question about multiple paths. Are you asking if MorphSVG can morph a group? If so, the answer is no. It works path to path. However, you can create a loop to handle a lot of paths at one time. I made this demo as an answer to a different forum question, but you can see how a loop of paths would work :

 

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

 

Hopefully that helps a bit.

 

Happy morphing.

:)

  • Like 1
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.
×