Jump to content
GreenSock

jstafford

Morph SVG , Namespace problem?

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

Hi greensock community,

 

Its been a long time since I have used Morph SVG plugin. Anyway, originally I was getting the "convert to path" error even though I had no shapes and everything was in path already. When I use the "MorphSVGPlugin.convertToPath" it throws a namespace error after that. Not sure what I am missing.

 

John

See the Pen mPpwaM by jstafford (@jstafford) on CodePen

Link to comment
Share on other sites

Hey jstafford :)

 

Looks like you're naming and trying to morph the entire SVG. Just move your ID to the paths themselves and it all should work fine for you.

//switch this
<svg id="arrow-left-post-hover" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 451.8 451.8">
<path d="M97.1,225.9c0-8.1,3.1-16.2,9.3-22.4L300.7,9.3c12.4-12.4,32.4-12.4,44.8,0c12.4,12.4,12.4,32.4,0,44.7L173.5,225.9
l171.9,171.9c12.4,12.4,12.4,32.4,0,44.7c-12.4,12.4-32.4,12.4-44.8,0L106.4,248.3C100.2,242.1,97.1,234,97.1,225.9z"/>
</svg>

// to this
<svg  version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 451.8 451.8">
<path id="arrow-left-post-hover" d="M97.1,225.9c0-8.1,3.1-16.2,9.3-22.4L300.7,9.3c12.4-12.4,32.4-12.4,44.8,0c12.4,12.4,12.4,32.4,0,44.7L173.5,225.9
l171.9,171.9c12.4,12.4,12.4,32.4,0,44.7c-12.4,12.4-32.4,12.4-44.8,0L106.4,248.3C100.2,242.1,97.1,234,97.1,225.9z"/>
</svg>

Hopefully that helps.

 

Happy morphing.

:)

  • Like 2
Link to comment
Share on other sites

thanks PointC. no wonder I was getting that message.

 

See the Pen RaxZjJ by jstafford (@jstafford) on CodePen

 

I did a little work but I am not happy with the asymmetrical morph here. Any way to fix this or ensure that it morphs symmetrically?

Link to comment
Share on other sites

Thanks PointC. I am searching but haven't seen any codepen that shows me how to marry up a point on one shape with another point on another shape.Like, how is this working?,

See the Pen LpxOqR by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

o.k. - I took your arrows into Adobe Illustrator and added some anchor points. One on the middle of the curved part of the start path and one on each side of the 'v' shape on the ending path.

 

Is this more the way you wanted your morph to look?

 

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

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