Jump to content
GreenSock

bomortensen

Animating SVG line strokes with DrawSVG plugin

Recommended Posts

Hi all,

 

I'm trying to animate an SVG <line> and a <circle> which are both dashed. What I need is the dashes to be shown one-by-one (staggered, I guess :-)) to make the line "drawn".

 

I've tried animating the strokeDasharray like so (where "secondStepDashedLine" is the <line> element) which didn't do anything really:

tlInitial.staggerFrom(secondStepDashedLine, 1, { strokeDasharray: 0 }, 1.5);

Is there any way of doing this? :-)

 

Thanks in advance.

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

Link to comment
Share on other sites

Hi bomortensen :)

 

Welcome to the GreenSock forums.

 

The easiest way to animate a dashed line with the drawSVG plugin is by using a mask. I wrote about that technique in our ongoing 'SVG Gotchas' thread here:

 

http://greensock.com/forums/topic/13681-svg-gotchas/?p=57942

 

Hopefully that helps a little bit.

 

Welcome aboard and thanks for being a Club GreenSock member.

 

Happy tweening.

:)

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