Hello,
i’m new in hype and I have a question.
I have a scene containing a movie (ID ‘video1’)
At specific times (2 seconds, 5 seconds, 9 seconds) time axis (info1_start_button, info2_start_button, info3_start_button) start.
This is the code:
function js_scene(hypeDocument, element, event) {
// This establishes the T1 variable as an integer.
var T1 = 0;
var T2 = 0;
var T3 = 0;
// Listen to the 'timeupdate' value:
hypeDocument.getElementById('video1').addEventListener('timeupdate', function() {
var currentTime = hypeDocument.getElementById('video1').currentTime;
// if the current time is greater than 2, run the info1 timeline.
if (currentTime >= 2 && T1 == 0) {
hypeDocument.startTimelineNamed('Info1_start_button');
// This ensures that the 'startTimelineNamed' action only occurs once, not at every point beyond time = 13.
T1 = T1 + 1;
}
// if the current time is greater than 5, run the info2 timeline.
if (currentTime >= 5 && T2 == 0) {
hypeDocument.startTimelineNamed('Info2_start_button');
// This ensures that the 'startTimelineNamed' action only occurs once, not at every point beyond time = 24.
T2 = T2 + 1;
}
// if the current time is greater than 9, run the info3 timeline.
if (currentTime >= 9 && T3 == 0) {
hypeDocument.startTimelineNamed('Info3_start_button');
// This ensures that the 'startTimelineNamed' action only occurs once, not at every point beyond time = 37.
T3 = T3 + 1;
}
});
}
Everything works fine for the first time I play the scene in a browser. But when I loop the scene the time axis doesn’t start from second loop.
I think I do not have to loop in hype but in the java script.
I think I have to tell hype in the script that for example after 20 seconds the scene shall be repeated. But how can i do this?
Thanks a lot