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.

Cheers,
Quint

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?

Test.hype.zip (13.6 KB)

Test.hype.zip (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:

Really?

Take a look, Jonathan responded to my thread. If he’s not using javascript what then?
https://forums.tumult.com/t/reverse-speed-in-continue-timeline-play-in-reverse/11905/8?u=petester

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;

	hypeDocument.pauseTimelineNamed(tl);

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

	reverse();
2 Likes

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.

Aperture.hype.zip (2.5 MB)