Jump to content
Search Community

ColorPropsPlugin

bibbyj test
Moderator Tag

Recommended Posts

Hi guys

I'm trying to follow a tutorial, part of which uses the color Props Plugin, but it seems to have been removed from gasp 3. Has it been totally removed, or has its functionality been absorbed into another plugin, I can't seem to find any mention of it in the release docs, blog etc, Thanks in advance...

Link to comment
Share on other sites

See the Pen ExaXjmr?editors=0010 by Sahil89 (@Sahil89) on CodePen

 

You no longer need colorProps plugin, gsap will detect color strings and animate them. From release notes

 

Quote

The core engine will find colors inside complex strings and animate them properly (no plugins necessary). And of course it'll find all the numbers inside complex strings and animate those as well.  

 

There is also new utility method called splitColor that you may find useful.

  • Like 4
Link to comment
Share on other sites

8 minutes ago, Sahil said:

 

 

 

You no longer need colorProps plugin, gsap will detect color strings and animate them. From release notes

 

 

There is also new utility method called splitColor that you may find useful.

Thanks for the quick reply, exactly what I needed to know, and yes I've been looking at splitColor, going to have a play with it shortly, so much to learn, and so many toys to play with! 

  • Like 2
Link to comment
Share on other sites

  • 1 year later...

So I was learning from some demo for animating with Canvas and GSAP at this thread that happened to use the antiquated `colorPropsPlugin`. I'm delighted to learn that it's easy to migrate from this plugin with a few changes.

 

Example for anyone interested:

 

Old code:

 

const tl = new TimelineMax({repeat: -1, yoyo: true})

tl.staggerTo(
  rects,
  0.5,
  {
    colorProps: {
      fill: "#f1af11"
    }
  },
  0.1
);

 

rects here is just an array of different shapes I draw in Canvas. Each shape is an object with several properties, one of them is `fill`.

New code:

 

const tl = gsap.timeline({ repeat: -1, yoyo: true})
tl.to(rects, {
  duration: 0.5,
  fill: "f1af11",
  stagger: {
    each: 0.1
  }
})

 

 

Finished code

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