Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Acmafali

Morphing help - cannot morph a <G> SVG element.

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

Hi,

 

I'm trying to morph one SVG to another, the SVG's are ontop of each other. Its an SVG of a brain that morphs into a thumbs up. I keep getting the error:

WARNING: cannot morph a <G> SVG element. Use MorphSVGPlugin.convertToPath(elementOrSelectorText) to convert to a path before morphing.

The brain has an id of #start.

The thumbs up as an id of #end.

 

The thumbs up is hidden in the css.

 

I'm not sure where I'm going wrong, the codepen is attached.

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

Link to comment
Share on other sites

Hi Acmafali :)

 

with MorphSVGPlugin you can Morph these SVG tag : <path> <polyline> <polygon> ,  not group of svg elements ( < g > tag )
  
There's a utility function, MorphSVGPlugin.convertToPath() that can convert primitive shapes like <circle>, <rect>, <ellipse>, <polygon>, <polyline>, and <line> directly into the equivalent <path> that looks identical to the original and is swapped right into the DOM.
  • Like 3
Link to comment
Share on other sites

Hi Diaco,

 

I tried to include those tags into the MorphSVGPlugin.convertToPath() utility function but i still get the same problem, i excluded the <g> tag as well. Really confused :(

Link to comment
Share on other sites

Acmafali, i did notice in your codepen example above that your <g> tag with an id of #end was empty and had no <path>, <polyline>, or <polygon> element inside it like Diaco advised above.

  • Like 1
Link to comment
Share on other sites

Yup!

 

I got rid of all of the groups when in adobe illustrator, its all good now!

 

Thanks guys!!

  • Like 1
Link to comment
Share on other sites

  • 4 years later...

I'm having same issue here. My SVG is a combination of 4 different SVGs grouped together with individual levels as IDs.
How do I get around this to morph the impression groups into another?

 

I've tried everything.

impressions.svg

Link to comment
Share on other sites

On 3/10/2016 at 3:02 PM, Acmafali said:

Yup!

 

I got rid of all of the groups when in adobe illustrator, its all good now!

 

Thanks guys!!

How? My SVG is a group of four different SVGs!

Link to comment
Share on other sites

1 hour ago, Electric Circus said:

My SVG is a combination of 4 different SVGs grouped together with individual levels as IDs.
How do I get around this to morph the impression groups into another?

Combine all of the paths in each group into a singular path. Then morph between those paths.

 

Alternatively make sure that each group has the same number of paths and then morph each path into the one with the same index in the next group.

  • 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.

×