# Check if animation has completed playing

**URL:** <https://forum.babylonjs.com/t/check-if-animation-has-completed-playing/16237>\
**Category:** Questions\
**Created:** [December 2, 2020, 1:41pm UTC](https://forum.babylonjs.com/t/check-if-animation-has-completed-playing/16237 "2020-12-02T13:41:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![John.Kress](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@John.Kress](https://forum.babylonjs.com/u/John.Kress)\
**Post date:** [December 2, 2020, 1:41pm UTC](https://forum.babylonjs.com/t/check-if-animation-has-completed-playing/16237/1 "2020-12-02T13:41:16Z")

</div>

Hi,

I am having trouble with animations. I can easily play it but I am not sure how to check if the animation has finished playing. Is there a way to check in my playground?

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#1GSCZY)**

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 2, 2020, 1:42pm UTC](https://forum.babylonjs.com/t/check-if-animation-has-completed-playing/16237/2 "2020-12-02T13:42:44Z")

</div>

you can use the last function parameter as a callback when animation ends: [https://www.babylonjs-playground.com/#1GSCZY#1](https://www.babylonjs-playground.com/#1GSCZY#1)

---

<div class="post-metadata">

**Author:** ![John.Kress](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@John.Kress](https://forum.babylonjs.com/u/John.Kress)\
**Post date:** [December 2, 2020, 1:47pm UTC](https://forum.babylonjs.com/t/check-if-animation-has-completed-playing/16237/3 "2020-12-02T13:47:07Z")

</div>

Thank you. Can I use it outside the function? That is after `addButton("Play", function () {}); `?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [December 2, 2020, 2:44pm UTC](https://forum.babylonjs.com/t/check-if-animation-has-completed-playing/16237/4 "2020-12-02T14:44:40Z")

</div>

You can only use it where you launch the animation. So if the animation is inside the addbutton function, sure else I do not see how.
