[SOLVED] Check for animation fail

Hello, when my player change animation the state variable change from idle to attack etc etc.
and i have this line that check when the animation is finished

if (this.state==='attack' && this.model.animation.currentTime >= this.model.animation.duration)

but it happens that this check is fired before the animation for attack start so it ends before start, any idea how can i overcame that?

Solved i just added this.model.animation.currentTime=0 at the end of previous animation. Thanks a lot.