Play a timeline for a random duration

Hello everyone

I have managed to get my timeline to jump to a random point on a button click using a random number and goToTimeInTimelineNamed but what i would rather do is play the timeline from the start until the random time rather than jumping straight to it. Is there something simple I am missing?

Any help would be gratefully received.

Simon

var myJumpTime = Math.floor(Math.random()*1000 + 1);
setTimeout(function(){  
  hypeDocument.pauseTimelineNamed('Main Timeline' )
}, myJumpTime);

In this, myJumpTime would be any number of milliseconds between 1 and 1000 (1 second). So the timeline will be paused at a random time.

1 Like

That’s great. thank you so much.