Bug? Can't transition and jump to middle of scene

Toy example attached.

Cannot jump to a scene and continue the timeline at a point in the middle. It jumps to the right scene, and momentarily shows the right point in the middle of that scene (here, 10 seconds in).

But then instantly it restarts the second scene. It does appear to work when hypeDocument.kSceneTransitionInstant is used, but no other transitions.
JumpToMiddle.hype.zip (25.6 KB)


Hi Rich!

I think we can file this under “that’s the way it is”.

With that idea in mind let’s “tag team” the issue using the “On Scene Load” event in Scene 2 - in addition to the code from your original script (just below) which is triggered in Scene 1:

hypeDocument.showSceneNamed('Scene 2', hypeDocument.kSceneTransitionCrossfade, 1.1)
// only seems to work with hypeDocument.kSceneTransitionInstant
//  hypeDocument.showSceneNamed('Scene 2', hypeDocument.kSceneTransitionInstant, 1.1)
hypeDocument.goToTimeInTimelineNamed(10, 'Main Timeline')

Now for the tag team:
We need to tell Hype to go to the 10 second mark twice in the cross-fade transition - once from Scene 1 and then again when Scene 2 opens.

Scene 2’s “On Scene Load” handler (in the “Scene Inspector” panel):

Note: You could write a JavaScript for the above but for my purposes here I found it simpler to use the “Scene Inspector”.

Hype project: JumpToMiddle_JHSv1.hype.zip (23.3 KB)

Just on a quick look at this…

The trick is to put the animation on it’s own timeline so it does not clash with the main timeline transition.

Two ways to do this.

First use Custom Behaviours.

Move the Animation on scene 2 to it’s own timeline.

On scene to Scene Inspector. add a Custom Behaviours like this.

In the code

hypeDocument.showSceneNamed('Scene 2', hypeDocument.kSceneTransitionCrossfade, 1.1)


JumpToMiddle_MHv1.hype.zip (21.9 KB)

Second way just using you code but with the animation on its on timeline.

hypeDocument.showSceneNamed('Scene 2', hypeDocument.kSceneTransitionCrossfade, 1.1)
hypeDocument.goToTimeInTimelineNamed(10, 't2')
hypeDocument.continueTimelineNamed('t2', hypeDocument.kDirectionForward, false)

JumpToMiddle_MHv2.hype.zip (22.0 KB)

1 Like

Just to chime in on the “why” - the Hype Javascript API for goToTimeInTimelineNamed() uses the current scene. An instant transition changes the current scene instantly, but when using a different transition the current scene is still the older one (the source) until the transition has finished. Thus the goToTimeInTimelineNamed() call is not operating on the destination scene but the source scene. I do consider it a design flaw, but unlikely to be resolved anytime soon as we don’t often make API changes.