I Have a Navigation in which i want to control multiple timelines. Im sure JS is the way to go and i would appreciate any help anyone could give with me being new to Javascript.
In my example i have a Navigation that controls two timelines. Ultimately i will need to control 8 different ones.
If i press the “move to green” button, the timeline will center the green object and some text info will appear.
What i Want to Happen is this:
Now that The green is showing with info, when i click the “Move to Blue” button, it will slide the timeline to blue and continue the previous timeline so that the info disappears.
As it currently sits, The info remains showing whenever i click the buttons multiple times. nav_control.hype.zip (20.8 KB)
5 downloads before I got here and no-one helped tut-tut
Here is an adaptation. Basically, as you were going back to the beginning of each timeline I got rid of the extra bit at the end. If you wanted that bit in, no problem you can use the same principals. It might not work as expected but I think the gist here is to understand relative timelines a bit more.
This is great! The only problem i see is if i have a lot of timelines i wold have to have many actions on each navigation button.
For instance if i had 10 time lines I would have 11 actions on each navigation. I guess i need to look at your basic principal here and possibly make a JS array to put it to work to only have one action verses multiple on the navigation.
You could (and this is thinking off the top of my head) have an array of the timelines and search the array for the element.id that is clicked and then remove the associated timeline from the array. And then run a loop on the remaining timelines that runs the Hype “continueTimelineNamed” method.
Something like:
var timelines = ["t1", "t2", "t3", "t4", "t5" ];
var index = timelines.indexOf(element.id);
if (index >= -1) {
timelines.splice(index, 1);
}
for (var i=0; i < timelines.length; i++) {
hypeDocument.continueTimelineNamed(timelines[i], hypeDocument.kDirectionReverse, false)
}
hypeDocument.continueTimelineNamed(element.id, hypeDocument.kDirectionForward, true)
This is just off top of head haven’t had time to check if it works