My problem is that each of my click on my button restarts this timeline.
As far as I can tell the "bouton" is the only trigger~input for running the JS function "testvar"; and the only place the variable "clickbutton1" is set is in this function. As a result every time "testvar" is run "clickbutton1" is always set to "0" - and the second timeline "animcarre" will never run.
var clickbutton1 = 0; // here's the problem "clickbutton1" will always be "0"
hypeDocument.getElementById('cover').style.display="block";
if (clickbutton1 == 0){
hypeDocument.startTimelineNamed('animrond', hypeDocument.kDirectionForward);
clickbutton1++;
console.log (clickbutton1);
}else {
hypeDocument.startTimelineNamed('animcarre', hypeDocument.kDirectionForward);
clickbutton1--;
}
In my version (please see below) _"window.clickbutton1 = 0;"_ is in the "Head HTML" (found in the "Document Inspector" panel) and removed from the function "testvar". You could also initialize the _"clickbutton1"_ variable in an "On Scene Load" event (in the "Scene Inspector" panel).
The two timelines run alternately (I think this is the effect You want).
test_JHSv1.hype.zip (17.5 KB)