Jump to content
Search Community

GSAP.UTILS HELP toArray + random

pietM test
Moderator Tag

Go to solution Solved by pietM,

Recommended Posts

Hi all! 

 

I'm trying to run a timeline using gsap's toArray and random utilities. In the attached demo, I have a simple sequence that I would like to randomize and re-randomize on repeat. 

 

2,5,7,8,9....etc. 

repeat 

3,8,7,1,2...etc.

 

I've reviewed the documentation and haven't been able to figure out how to implement gsap's random or shuffle utility to achieve this. 

As always, I appreciate any and all guidance. 

 

See the Pen b6ec32105578a360dc4c47bc3809e2f5 by evryali (@evryali) on CodePen

Link to comment
Share on other sites

Great. Thank you @mvaneijgen@ryan_labar!!

Calling the function onComplete makes sense! But, is there a way to achieve the random re-set, etc. without the use of keyframes? Is there a reason NOT to use a timeline (If I wanted to add complexity to the animated sequence)?

Thanks for your feedback and help!! 

Link to comment
Share on other sites

  • Solution

Thank you @ryan_labar , @mvaneijgen and @PointC!!

 

This probably isn't as elegant as the proposed solutions , but it came down to how to link the array to GSAP's shuffle utility.  Thanks again for the speedy and useful feedback. 

Love this platform!! 

 

Here's my solution: 

 

See the Pen 94e2c7952237f4236535cceabbc1a64a by evryali (@evryali) on CodePen

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