Jump to content
GreenSock

ltscribble

scroll through colors - svg

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

I want to get a fill for an svg to scroll through multiple colors. I've done it this way but I'm not sure if there is a better way of doing it?

 

var hand = $("#left-hand-palm");
var colors =["#FF0000","#FFFF00","#00FF00","#00FFFF","#0000FF","#FF00FF","#ED1C24","#FFF200","#00A651","#00AEEF","#2E3192","#EC008C","#FF0000"];
 
tl = new TimelineMax({repeat:-1});
 for (j = 0; j < colors.length; j++) {
      tl.to(hand, 1, {fill:colors[j], ease:Linear.ease});
};

See the Pen EaWqZm by LegendT (@LegendT) on CodePen

  • Like 1
Link to comment
Share on other sites

Nice job. That is probably exactly what I would recommend. Don't see anything wrong with that.

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