Jump to content
Search Community

drawSVG not animating path

Donatello666 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,

 

i got a strange problem:

I want to animate the following SVG:

 

<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512">
  <path id="cross" d="M405 136.798L375.202 107 256 226.202 136.798 107 107 136.798 226.202 256 107 375.202 136.798 405 256 285.798 375.202 405 405 375.202 285.798 256"/>
</svg>

 

TweenMax.to( $('#cross') , 1, { drawSVG:"0%" } );

 

I see in the DOM-Tree GSAP is changing values, but without any visual changes.

 

What am I doing wrong?

Link to comment
Share on other sites

I did a quick paste of your SVG into a CodePen demo.

Seems you did not have a stroke applied. 

When I applied a stroke color and width it appears the stroke does not cover the whole shape. Perhaps you need to close the path.

You can seen in the demo that DrawSVG will work fine on the stroke around the path.

 

See the Pen EwLMwz by GreenSock (@GreenSock) 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.
×
×
  • Create New...