Swapping Animations on Screen Touch

Hi everyone, I’m a PlayCanvas learner and I’m trying to do something about animation, but I got stuck.

Here is the link of the project: PlayCanvas | HTML5 Game Engine

I want to change the color of the heart and the animation state on every touch on screen. It will start with ‘beating heart animation active’ and heart is red, when I touch, the heart will be gray and the animation will go to ‘idle state’. I came to a point where I can change the color on every touch and change the animation state to ‘idle’ on the first touch, but I couldnt create a loop for this change on every other touch.

Thank you.

1 Like