Randomize 3 timelines and start the choosen one

I followed the Max Zieb instructions about using chatGPT and I've got this running code for me:

 // Get an array of the names of all timelines
  let timelineNames = ["attivita1", "attivita2", "attivita3"];
  
  // Generate a random index from 0 to 2
  let randomIndex = Math.floor(Math.random() * 3);
  
  // Pick the timeline at the random index
  let timelineName = timelineNames[randomIndex];
  
  // Start the randomized timeline
  hypeDocument.startTimelineNamed(timelineName, hypeDocument.kDirectionForward);
1 Like