'Phaser 3 - currentAnim is undefined

I am trying to reset my animation back to frame 0 after finishing. For this I am using following code:

gameState.idle.play('wag', true).on('animationcomplete', () => {gameState.idle.pause(gameState.idle.currentAnim.frames[0])});

However when I try this I get the error

Uncaught TypeError: gameState.idle.frames is undefined

How can I fix this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source