Jump to content
Search Community

gsa.utils.wrap() i need random values

Rebeca test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

I need to randomize the colors to each .box. I tried utils.wrap but it places them in an order, and with "random" they all get painted a color and the color changes when updating .... What can I do? I've been with gsap for two weeks and I'm a bit dizzy with so much information

See the Pen dyNJOrj by rebecakarenok (@rebecakarenok) on CodePen

Link to comment
Share on other sites

  • Solution

You just need it to return a function so it gets called for every element. Notice the true at the end.

 

gsap.set('.box', {
  backgroundColor: gsap.utils.random(['#efecca', '#a9cbb7', '#f7ff58', '#ff934f', '#5e565a'], true),  
})

 

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