Jump to content
GreenSock

axy2016

MorphSVG: How to change fill color?

Moderator Tag
Go to solution Solved by GreenSock,

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,

 

I was following along with the MorphSVG demo, and was wondering how you would change the color of the second shape?

Both shapes have their own color, but the morphing keeps it at the #start fill color.

 

 

Thank you!

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

Link to comment
Share on other sites

  • Solution

Morphing is just for the shape itself, but all you need to do to animate the fill is add it to the tween, like:

TweenMax.to("#start", 5, {morphSVG:"#end", yoyo:true, fill:"#FF1D25", repeat:-1});

Here's an updated codepen: 

http://codepen.io/anon/pen/vLjVay

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