Juc1 Posted March 10, 2021 Share Posted March 10, 2021 Hi all, My SVG flower classes animate in the order given by the HTML = pink, blue, red, purple - can anyone please tell me how I could say - animate in a random order each time the page is loaded eg blue first, next time red first etc See the Pen QWGJNbx by Juc1 (@Juc1) on CodePen Link to comment Share on other sites More sharing options...
Solution tailbreezy Posted March 10, 2021 Solution Share Posted March 10, 2021 Hello, You can use one of gsap utilities. let flower = gsap.utils.toArray(".flower"); let shuffled = gsap.utils.shuffle(flower) ... shuffled.forEach(item => { let stempath = item.querySelector(".stem"); ... 6 Link to comment Share on other sites More sharing options...
Juc1 Posted March 10, 2021 Author Share Posted March 10, 2021 @tailbreezy perfect thank you 👌 Just adding the link to the docs https://greensock.com/docs/v3/GSAP/UtilityMethods/shuffle() 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now