Share Posted March 10 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 post Share on other sites
Solution Share Posted March 10 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"); ... 5 Link to post Share on other sites
Author Share Posted March 10 @tailbreezy perfect thank you 👌 Just adding the link to the docs https://greensock.com/docs/v3/GSAP/UtilityMethods/shuffle() 2 Link to post Share on other sites
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