Animation out of sync?

What do you want to achieve?

I would like to have an animation going infinetely in loop when that particular screen is active.

Mention some use cases

I am making a small project with 4 different screens loaded. Platform ESP32-WROOM-32D display round 1.28" 240x240. I’ve built an animation similar to the one used for the “dots” of the watch in the analog screen (fading on and off). It’s an infinite loop that is called when the screen is loaded. I’ve got a button so I can cycle between the active screens. At the first iteration/cycle the animation is always correct and fluently, in the next itarations the animation is 90% of the times buggy and seems like the loops for the fading are out of sync. I’ve disabled all the subtask of the main program (so only the screen loading/animation is execute) and the problem persist. I’ve tried to disable the infinite loop option and inserted a defined number of iteration. If I reload the screen after a defined time (so when the animation has finished the loop count) the animation is always working. I’m pretty sure the problem is not of squareline library but probably someone has just encounter a similar problem. At the moment I cannot attach videos of the problems.

Thanks

Your problem might be that when you leave the screen the oniginal animation is not stopped/deleted so when you leave and then reload the screen a new animation is created that clashes with the already running animation(s).
Therefore infinite animations shouldn’t be created when a screen loads but at the beginning of the program, so you should start them by events in the initial actions (or a top-layer) ‘screen’ instead. That way they’re created only once, won’t accumulate, and will run infinitely in the background no matter if you change a screen: Trouble with anim
(In case of temporary screens where the animation targets get deleted, extra care should be taken te delete the animations together with the closed screens: Temporary Screen with an infinite loop animation crashes when deleted - #5 by CodeGrue )

From a coding perspective, your suggestion makes sense. But all this code was autogenerated by the SquareLine tool, so it should incorporate these behaviors in the autogen code. There is no way I can tell to inject this behavior from supplement code, because the animation object is private and inaccessible, as opposed to global like most of the other objects. It needs to be inherent in the instantiation of the animation object to allow for a solution.

Thank you a lot Hermit. In my particular case the solution of using the initial actions works like a charm!

Best Regards

1 Like