Check if a clip animation is finished (current frame)?


I have a clip that plays an animation, and I’d like to able to tell when the animation has reached the last frame. I used to putter around a bit with Adobe Animate, and I got used to using something like this:

if (object.currentFrame == 12)

I was curious if there’s some similar method for checking frames in Wick?



I do not know if there is a way to know the current frame without doing this:
On Frame 1, run this code: project.currentFrame = 1
On Frame 2, run this code: project.currentFrame = 2
On Frame 3, run this code: project.currentFrame = 3
…and so on.



Thanks for the reply! I guess since Wick really reminds me of working with ActionScript in Animate, I was curious if there was some kind of built-in currentFrame property (I had no idea since I’ve only been using Wick for a couple days). If not, no prob, this works just as well.



Hey @bluecake, welcome to the forum!

@DylanExists is on the right track! You should be able to call this.currentFrameNumber from inside the script of any object to see its current frame!

You can also call this.currentFrameName to get the name of the current frame if it has one.

Then, you can check

if (this.currentFrameNumber === 12) to do what you’re looking for.

I think I may have forgot to include this in the built-in reference :stuck_out_tongue:

Let us know if this works!



Ah, that’s what I was looking for! Works perfectly, thank you. :grin:

1 Like