Jump to content
Search Community

DrawSVG and SVG Text Element

JustinBinAz 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

Hello All,

 

I see a lot of Codepen examples that show DrawSVG being used on SVG paths, whether those paths form text or another graphic altogether. Is it possible to use DrawSVG to animate the stroke of an SVG text element just as you would animate an SVG path?  If so does anyone have a link to a Codepen that I could check out as an example?

 

Thanks in advance!

Link to comment
Share on other sites

HI @JustinBinAz :)

 

Welcome to the forum and thank you for joining Club GreenSock.

 

I assume you're talking about an actual SVG text element and not converting that to a path? You can't do that with DrawSVG since it's not a path, but you might be able to make it work by animating the stroke-dashoffset. 

 

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

I would not recommend this for production though. My advice would be to convert your text to paths in your vector software and you'll be good to go with DrawSVG. The above technique gets really weird when you start changing the SVG size and font size.

 

Hopefully that helps. 

 

Happy tweening and welcome aboard.

:)

 

 

 

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