Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Animate svg with gradient

Recommended Posts

Hi all :)


I need to animate an svg with gradient and I'm using SMIL at this time. Unfortunately in IE and Edge it doesn't works


Is it possible to animate it with GSAP?


Thanks in advance

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

Link to comment
Share on other sites

Hello redmile, and welcome to the GreenSock forum!


You can try and use a staggerTo() tween along with the special cycle property to animate a SVG gradient


See the Pen WraOVy by jonathan (@jonathan) on CodePen


It will stagger through all of the SVG <linearGradient> <stop> elements.


It uses the GSAP cycle property which is only available for stagger tweens


  • Like 2
Link to comment
Share on other sites

Hello jonathan and thanks :)


Annoyng question: Can You please provide me a working example with my codepen?

Link to comment
Share on other sites

try this redmile:


See the Pen rxRGjg by jonathan (@jonathan) on CodePen


also i used this online SVG cleanup tool to optimize your SVG code (dont forgot to un-toggle Clean ID's)




read this GreenSock article on using the cycle property with stagger tweens:




keep in mind that the gradient <stops> elements you have are all the same color, if you change their starting values it will animate the color better.



Link to comment
Share on other sites

Thanks again Jonathan!! :D Really helpful :)

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