Jump to a time in another scene

From scene A I want to have some buttons pointing to different times in the main timeline of scene B. Is this possible? Thanks for any help!

hi,

you’ll need a global var …

button

time = yourdesttime

scene b onsceneload

hypeDocument.goToTimeInTimelineNamed(time, 'yourtimelinename')

you may work around js by using persistant symbols … depends on your needs …

1 Like

Thank you! I think I get the idea, but I am not so familiar with how and where to create this global variable. I understand that the button, when clicked/tapped will set the variable to 1,2 or 3 etcetera, and onsceneload it will go to that place on the timeline.
So I have to find a variable tutorial and a make-the-right-calls-tutorial…
But I do understand the logic, thanks a million!

You can also possibly use a custom Behaviour.

On Scene B’s Behaviour , create a Behaviour that goes to time in timeline. Call it for example button1

Then on Scene A,

Select your button 1 and give it a 2 On Mouse Action:

Jump To scene B.
Trigger custom behaviour button1.

This should work with transitions or instant.

Each button can have its own create a Behaviour

2 Likes

http://www.epx.se/epxProblem.zip
There are two ways to navigate, a menu and some buttons (on a map). The menu works fine with two actions (go to scene, go to time), but the buttons don’t . I tried the behavior thing too, but the buttons just make it slide to time 1 on the timeline, or sometimes 8, other end.
Probably I make some mistake that I can’t see…

would be good, if you have any example document for your problem.

Trying to fix that. The thing I work with is so big so I’ll strip off all that is not relevant for this. Stay tuned…

Try assigning two actions…

1 Like

I know, my mistake.
Sorry about that!

Please see link to document above.

The Behaviour method works if you move the animations off the main timeline and onto a new timeline.

You can just duplicate the main time line on scene 2 in the Animations Timeline’s on the Scene inspector.
Then remove them from the original Main Time line.

(I think Hype is struggling with the logic when you use a main timeline to do this)

epxProblem.hype.zip (82.0 KB)

Note I took out the 12MB file so I could post the example back here…

1 Like

Thank you so much for this kind tip, Mark. Will try it as soon as I get back to my base camp in a day or two.

1 Like

In theory very nice … but it does not seem to work.

If it works, can this be translated to an external link too?

So a href link on a website that points to a specific time in a specific timeline in a specific Hype scene?

you’ll need to script this.

window.location.hash

would be the road to go

this woud be a nice basis:

this should work on scene load:
var checkHash = function() {
var hash = window.location.hash.substring(1).split(’?’);

for (var i = 0; i < hypeDocument.sceneNames().length; i++) {
if (hypeDocument.sceneNames()[i] == hash[0] && hypeDocument.currentSceneName() != hash[0]) {
hypeDocument.showSceneNamed(hash[0]);
hypeDocument.goToTimeInTimelineNamed(parseInt(hash[2]), hash[1])                
break;
}
}
};

if (window.loadedHashLocation != true) {
window.loadedHashLocation = true;
checkHash();
window.onhashchange = checkHash;
}

window.location.hash = "#" + hypeDocument.currentSceneName();

your url would look like:
yourDomain/yourDocument.html#yourScene?yourTimelinename?yourDestTimeInSeconds

This is not theory, It does work, but maybe not for your setup what ever that is ?

1 Like

Good Morning,

thx for your reply. This method:

hypeDocument.showSceneNamed(hash[0]);
hypeDocument.goToTimeInTimelineNamed(parseInt(hash[2]), hash[1])

we did get to work. Interesting is that we have one scene that for some reason does not work. But on scenes that we have set up fresh it works beautifully. Thank you for that!

What does not work on my machine is the demo hype file (epxProblem…). But since the problem is elegantly solved by the script above I for one am happy to have learned something new :wink:

Thanks.
It always helps to explain what does not work. The example file works here ( different Machine than I used before) But note all I changed in that example was add a Timeline that was not in the original

Any way there is always more than one way to skin a cat as they say… :relaxed:

Sorry for the delay… :sweat_smile:
Thank you very much for taking the time to answer this!

1 Like