Jump to content
Search Community

Morph SVG , Namespace problem?

jstafford 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

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

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