Play an animation from main loop

I want to have a button so when it is pressed it toggles the checked flag and have an event that when the checked flag is checked then an animation starts and runs continuously until I click the button again which would toggle the checked state to unchecked and stop the animation.

What have you tried so far?

Looking thru the event settings there is nothing for stopping an animation.

Others

  • SquareLine Studio version: 1.0.2
  • Operating system: Windows 10
  • Target hardware: esp32

Hi,

At this moment you can do it only with custom event handlers. I created a project which shows how to do it. The magic is in anim_while_checked_events.py.

It looks like this:
anim_while_checked

And the project:
anim_while_checked.zip (9.5 KB)

Project from ZIP file should work in SLS as is it shown here or we should use it with some simulator? If I import this project and try to run it, I get this error:

image

I tried this with SLS 1.0.4 & 1.0.5 .

It’s because now SLS adds ui_ prefix to widget names to be sure they not conflict with reserved words or other variables.

All you need to do is replacing all 3 occurrences of Panel1 with ui_Panel1 in anim_while_checked_events.py.

1 Like