Jump to content
GreenSock

Joostan

strokeDashoffset

Go to solution Solved by Carl,

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

Good morning people,

 

Could somebody explain why the 'strokeDashoffset' in the following pen will not animate?

 

 

Inspecting the element in the DOM and manually manipulating the 'stroke-dashoffet' i can easily animate property.

 

images attached.

 

Thanks

 

 

 

post-44139-0-92122000-1473121202_thumb.png

post-44139-0-70452100-1473121210_thumb.png

See the Pen kkYEpk by Joostan-33 (@Joostan-33) on CodePen

  • Like 2
Link to comment
Share on other sites

  • Solution

Thanks for the demo and images. Very helpful.

 

The issue was that you set stroke-dashoffset as a CSS property but tried to animate it as an html attribute via the AttrPlugin. This should do the trick:

animation.to(thisEl, 3, {attr:{cx:68, cy:67}, ease: Power2.easeOut, strokeDashoffset:62.84});

http://codepen.io/GreenSock/pen/kkYJwx

 

However, since you are a Business Green you should just use DrawSVGPlugin  :mrgreen:  :mrgreen:  :mrgreen:

animation.to(thisEl, 3, {attr:{cx:68, cy:67}, ease: Power2.easeOut, drawSVG:0});

http://codepen.io/GreenSock/pen/gwbzxb?editors=0010

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