Hi @amandagax and welcome!
I guess your code for ‘idle’ or ‘move’ is overwriting your ‘dash’ animation.
You’ll probably need something like a timer to give your ‘dash’ animation enough time to complete, before other code of your script can continue. You can check the topic below for some example code of a timer.
Maybe there is a better solution using the API’s of the page below, but I haven’t used sprite animations myself yet so I’m not sure.
https://api.playcanvas.com/classes/Engine.SpriteAnimationClip.html