How to animate using a key

Ive looked at other topics like this but they r confusing. I would like to play a running animation when you press the W key.

Have you looked at the animation blending tutorial? https://developer.playcanvas.com/en/tutorials/animation-blending/