Multiple Loop Animations

Hi all, hope someone can help me with a new problem I have?

I want to set up two different loop animations on different timelines. Is this possible?

I currently have this in the Head for my first loop animation:

<script type="text/javascript">
window.loopCounter  = 0;

And this as the Javascript function which is called loop()

if (window.loopCounter <= 10) {
hypeDocument.startTimelineNamed('Main Timeline', hypeDocument.kDirectionForward)

Hope do I set up both the Head and the loop function to create a different loop on a different timeline?

When you use the variable loopCounter it gets a numerical value and uses that to determine the number of loops for a specific timeline. If you wanted to track the loop count for two timelines, you would need to make a new variable. You could call it loopCounter2 -- as long as it has a different name it can hold a different value and count its own loops.

Oh I see, that makes sense. The first javascript function is names loop(). Do I need create another function and call it loop2 or something like that? Or can I create the second piece of code within the first loop function?

It depends how you’re using this, but my guess would be that you want to make two different functions. Make sure you also initialize a 0 value for loopCounter2 in the head (or whichever name you choose).

okay, do you think you could share the code that I would need to add for the extra loop animation?

Sure, here's an example: (14.6 KB)

Thanks Daniel, thats really helpful.

Just to let you know we have been so impressed with the App and the support available that we intend to buy another licence for the studio.

Thanks again!