Hello, I’m trying to use the time() function to determine when a timeline is complete and before it begins. I’m a bit confused on the syntax, as it seems like sometimes the “()” is necessary and other times it is not. This is the current code that I have working, and I was wondering if anyone could explain the difference between “.time” and “.time()”?
Hello @zhardy589,
Here’s the article about the time function on timelines:
https://docs.zap.works/studio/scripting/reference/timeline/functions/time-getter/
I don’t recomend use it to anything, only if you really, really, really need, because this function I don’t know, feels kinda bugged… By the way, in your cause you could use a label to check if the pointer passed throught a certain time, like this:
In this way I can tell you that you won’t have problems. How to do a label:
Set the time you want in “Time(ms)” to the point go till there (you also may click where you want to set the label) and then click with the right button of the mouse and click in Add Label. Set a name and then its done. To use it in the code, you can just drag and drop like this:
These are the events that a label can have:
The passfoward active when the pointer is goin’ foward (symbol.controllers.animation.elements.time.play()).
The backward active when the pointer is goin’ backward (symbol.controllers.animation.elements.time.play(-1)).
The pass active when the points is goin’ foward or backward.
Here’s the article about the labels:
https://docs.zap.works/studio/workflow/timeline-labels/
About the complete thing, you can check if the timeline is complete by an event called “complete”. To use it, all you have to do is drag and drop the timeline into the code, like this:
The event “complete” only active if the pointer reach this area here:
this means that if your timeline has the loop mode active, your code will never active complete event. You can find more here:
https://docs.zap.works/studio/scripting/reference/element/events/complete/
Hope this helps you.
att, Higão.
Thanks, I really appreciate the help! I have it working now, but knowing about labels is helpful.
This is good to hear zhardy!
att, Higão.