How do I disable looping of the animation?

I notice that the animation loops in both the editor and the player. Can I this disabled this in the editor? In the player? I would like it to stop on the last frame. I know I can create an update event handler in which I count the frames and call stop() on the last one, but there must be a more straight-forward way. Thanks.

I think that the only way to stop it is the “stop()” command.

Hey @david672orford, @DylanExists is right. Adding a stop() call to your last frame will stop the animation in the player.

What is the goal for your animation though? Do you want the exported gif to stop, or just want it to play once when previewing?

1 Like

i also had the same question in my opinion i just want it to play once when previewing

Hey @noone_here welcome to wick!

Ur able to do stop an animation from looping by simply going to the last frame that you’d like the project to stop on, click on the frame and go to the default script tab, and type this:

stop();

By doing so, the project would know to stop when reaching that frame.
I hope this is what u were asking for?

There are options on the clip. They show Loop, Single Frame, and Once. Loop loops the animation and is the default option for a clip. Single Frame stays on one frame for the entire time. You can control which frame the clip starts on. Once is the one you will be looking for. Once plays the animation once.

All great and correct answers, but what’s great about using Clips is that you combine its state e.g. Loop, Single Frame, Play Once with code in an animation if needs be.

For example the Single Frame Clip state is great for animation, because in this moving head animation I’ve got a single head Clip with different facial expressions on its timeline, using layers for the head, mouth, eyes and frame name labels. During the animation I can choose its different facial expressions by selecting the Clip and choosing a frame number from the Head’s timeline to show surprise, happiness etc.

But I can also keep the Clip state as its default of Loop and then use a simple code command to move the playhead to a frame label, again on the Head Clip’s timeline. All the code you need, assuming you’ve named your head Clip, ‘head,’ is something like head.gotoAndStop(“happy”).

Download, load it into The Wick Editor and then have a look at the wick source file I’ve attached to see what I mean and how the animation is set up.

MovingHeadAnimation.wick (6.0 KB)

MovingHeadAnimation.wick.zip (6.0 KB)

2 Likes

Looping Animations are especially good for walk cycles.

1 Like