Jump to content
Search Community

Animating Arrays - Giving each item a different random value

MadG test
Moderator Tag

Go to solution Solved by PointC,

Recommended Posts

No problem at all, we love us some GSAP here at our agency. 

 

I do actually have one more question. Say I wanted the random bounds to increase on each repeat. So first go round they go random(0,500), then next round random(0, 750), etc etc. Is there a way i can accomplish that?

Link to comment
Share on other sites

Nice job, @PointC. That's a great solution. 🎉

 

Very minor thing: 

newMax = newMax < 600 ? (newMax += 100) : (newMax = 100);

Should probably be: 

newMax = newMax < 600 ? newMax + 100 : 100;

 

I also thought of a different (not necessarily better) approach: 

See the Pen c784d28b84400ce17949fcd17d8a4bc6 by GreenSock (@GreenSock) on CodePen

 

But honestly, my first instinct was to go with precisely the technique @PointC suggested. 

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