Modify Duration of Timeline When Played In Reverse Using Javascript

Assume Timeline A is 2 seconds long.

If I set the start point at the 2 second mark and play the timeline in reverse, is it possible in Javascript to specify a different duration (compress/extend timeline), either shorter or longer? Let's say I want Timeline A to complete playing in reverse in 1 second.


you may set up a additional relative timeline for this

Hello Hans,

Thanks for responding. I don’t understand what you suggested. I have attached a test file. Can you tell me what I did wrong? (13.6 KB) (12.2 KB)

1 Like

Thanks, Hans!!! Relative timelines and Custom Behaviors are two features I have yet to master. Again, thank you for your time!

How do I increase the speed of reverse via javascript.

no way … actually :slight_smile:


Take a look, Jonathan responded to my thread. If he’s not using javascript what then?

It is something under-the-hood … :wink:

Haha. What could it possibly mean?

well, it possibly means that the hypemethod is encapsulated and not reachable by its API.

quick’n dirty you can do for example a timelineaction that’ll reverse the timeline by a given factor:

	var tl = event.timelineName, factor = 5, dur = hypeDocument.durationForTimelineNamed(tl);
	var step = (dur/60)*factor;


	function reverse() {
	var cT = hypeDocument.currentTimeInTimelineNamed(tl);
	var newTime = cT-step;
 	if(cT <= 0){
 	cancelAnimationFrame (reverser);
   	hypeDocument.goToTimeInTimelineNamed(newTime, tl);
   var reverser = requestAnimationFrame(reverse);


please notice that this method can cause other issues and should only be used for simple setups …

1 Like

Brilliant! Thank you Hans :pray:.

The reverse works great! Though Like you said, It does come with some set backs and the thing I noticed it doesn’t listen to other actions I set in place like continue timeline in the very beginning of the animation. It seems as though that reverse script takes control of the timeline for good. (2.5 MB)