How to trigger a button animation without interrupting a continuous loop (demo + remix)
Answering this amazing question by Rich here
The question!
I'm working on an interactive animation. I have a background element (let's call it the "top layer") that needs to loop continuously back and forth (left to right) on its own.
Below this looping element, I have a button. When a user clicks this button, it should trigger a one-off click animation.
Is it possible to set up the State Machine so that triggering the button animation does not interrupt, reset, or freeze the continuous loop of the top layer?
What is the best way to structure this? (e.g., using multiple layers in the State Machine, or nesting artboards?)Yes, this is totally doable, and you don't need multiple State Machine layers or nested artboards to pull it off. I'd actually flip the problem around: the reason loops freeze or reset is that the button click and the loop are fighting over the same timeline. So instead of making the click a timeline event, make it a style event.
Screen Recording 2026-07-16 at 15.54.56.mp4Here's how I'd structure it as a designer:
Keep one scene, one timeline. Your looping background lives on the main timeline and just plays forever. Nothing else ever touches it. Don't create a separate state for "button clicked", because jumping between states is exactly what interrupts the loop.
Design your button states as Motion Tokens. In Creator, I set up the "before" and "after" of the click as themes: each theme is just a set of token values (colors, gradients, opacities, and the button knob's position as a position slot). The artwork exists once. The states are just different values painted onto it. Motion tokens is our most strongest tool!
The click swaps token values, not animations. At runtime the click tweens from one theme's values to the other's. Since tokens change properties while the timeline changes time, they can't interfere with each other. The loop physically cannot be interrupted, no matter how fast someone spams the button.
I built a demo of exactly this: a smart-home scene where the background loops continuously and two toggles each trigger their own one-off transition (knob slides, whole scene re-lights). Try clicking mid-loop, nothing stutters:
🔗 Live demo:
🎨 Remix the animation in Creator (see how the themes and slots are wired):
Lottie Creator: Create Lottie animations with ease - LottieFilesA few reasons I'd push everyone toward motion tokens for this, beyond just solving the freeze:
You design every state, once. My file is a single scene plus four themes (All On, Outdoor Off, Indoor Off, All Off). Each theme is ~43 token overrides, zero duplicated artwork. Adding a fifth state is a new theme, not a re-animation.
States stay in your hands. Because the states are themes authored in Creator, you can retune the "lights off" palette anytime without asking a developer to touch code. The code only knows token names.
It's tiny. Four complete visual states of an entire scene, fonts included, is about 190 KB.
Tokens do double duty. The clock in my demo is a text token being fed the real time every second, while everything loops. Same system, so once your file is tokenized you get dynamic content basically for free.
So: no nested artboards, no layer juggling in the State Machine. One loop that owns the timeline, themes that own the states, and the button just moves values between them.
Also huge shoutout for folks trying out Lottie Creator!