Continue symbol when the scene's timeline changes

Let me explain my scene first:

I’ve a scene with a symbol named Illustrations. In that symbol, I have 2 timelines, Main Timeline and Slideshow. The Main Timeline just has one timeline action and that is to trigger a custom behaviour named symbolLoad. This behvaiour when triggered, goes to the start of the Slideshow timeline and continues it. The Slideshow timeline has all the animations of the images which actually constitute of the slideshow.

Now, in the scene, I have two (absolute) timelines, Main Timeline and Main Timeline 2. They’re light and dark theme (respectively) of the scene. I have a switch that lets users toggle the theme. The switch basically goes to a time in the other timeline (2 seconds in this case because I’ve animations at the start of the scene that I’d not want to play everytime the theme is changed). In both the timelines, at the start, I’ve added an action for the symbol that pauses the Slideshow timeline and on 2 seconds, I’m running JavaScript with the following code:

var time2 = hypeDocument.getSymbolInstancesByName('Illustrations');
var timePos = time2.currentTimeInTimelineNamed('Slideshow');
time2.goToTimeInTimelineNamed(timePos, 'Slideshow');
time2.continueTimelineNamed('Slideshow', hypeDocument.kDirectionForward, false);

Basically, I’m trying to check the time position in the Slideshow timeline of the symbol, store it in a variable and then, tell the symbol to go to that time in the timeline and continue it from there. This is because, when the theme is toggled, the slideshow resets to the first image. I’d really like if it goes on the way it was going.

How can I continue the symbol even when the theme is switched in my case? One thing I had tried was to remove the symbol actions from both timlines and that had worked. But, that’s causing the slideshow to start as soon as the scene loads and I want it to start after 2 seconds.

Here’s my file: (~18MB - available for 30 days from now).


From what I can see you do not need to do any checking on the timelines current time.
Just let the symbol play.

So I changed backround color to none on the ‘base’ element.
I have taken all pins off the dark/light elements.

Removed the Go to Timeline actions on the dark/light elements.

Now the symbole will not be interrupted and the backround changes you make to the scene actually show through.

( and yes wow, did not realise until I just tried it that you can share via icloud drive )

That’s a great suggestion. But, I also have other elements on the actual scene. The one I sent was a minifed version to just depict my problem and everything else was removed. The other elements need to change their colours according to the theme and thus, I need to go to time in another timeline (I have added keyframes in the start of both timelines to match the colour I need). Can I achieve that without changing timelines?

I’m not entirely certain on your entire document flow (puzzled about why you are using a custom behavior compared to a symbol action or on symbol load action, along with not a start timeline, etc…), but to clarify on timelines - even in symbols you can run multiple timelines in parallel. As long as you are not animating the same properties, there won’t be any conflicts. So you could just have separate timelines in the symbol that do the color changes, and another one that is the slideshow that isn’t touched.

That was as a result of a search that returned me this: Animation in symbol won't run independently of Main Timeline?

Sorry for not being clear in my opening post. My symbol is complete in the file that I posted. I just deleted the other elements from my Scene. I need to change colours of the objects in the scene and not within the symbol.

css and toggling by class¿

Yeah. That is my last resort if nothing else works. I just don’t understand why I was getting the error time2.currentTimeInTimelineNamed('Slideshow'); is not a function in my console. I thought my code was/is wrong and maybe if that gets fixed, my problem gets solved.

this holds an array. change it to

which would be the first symbolinstance

1 Like

I’m not really sure about that users’s configuration or the answer to that… basically symbol timelines, including their main timeline, are independent of any other timelines. However you can bind symbol timelines to a parent if the parent has a symbol action set to play a timeline, in fact we add a symbol action to play the symbol’s main timeline as convenience. But you can remove this by just deleting the symbol action. Please see:

1 Like

Yeah!! Just doing this worked!

1 Like

Oh, that’s an interesting information about symbols. Seems, I had it a bit wrong. That’s a faily detailed clarification. Thanks a lot.