Key p to start animation

if ((e.key === pc.KEY_P) && (this.state !== ‘Great_Sword_Slash.json’)) {
this.setState(‘Great_Sword_Slash.json’);

Hi, I noticed you keep posting similar questions everywhere on the forum. What is the problem you’re having?

ahh yess…
I have an Animation Blending that was basically to do a keyboard input

var AnimationBlending = pc.createScript('animationBlending');

AnimationBlending.states = {
    idle: { 
        animation: 'Rifle Run.json' 
    },
    punch: { 
        animation: 'Great_Sword_Slash.json' 
    }
};

// initialize code called once per entity
AnimationBlending.prototype.initialize = function() {
    this.blendTime = 0.2;

    this.setState('Rifle Run');

    this.app.keyboard.on(pc.EVENT_KEYDOWN, this.keyDown, this);
    this.app.keyboard.on(pc.EVENT_KEYUP, this.keyUp, this);
};

AnimationBlending.prototype.setState = function (state) {
    var states = AnimationBlending.states;
    
    this.state = state;
    // Set the current animation, taking 0.2 seconds to blend from
    // the current animation state to the start of the target animation.
    this.entity.animation.play(states[state].animation, this.blendTime);
};

AnimationBlending.prototype.keyDown = function (e) {
    if ((e.key === pc.KEY_P) && (this.state !== 'Great Sword Slash')) {
        // Great Sword Slash
        //this.setState('Great sword Slash');
    }
};

AnimationBlending.prototype.keyUp = function (e) {
    if ((e.key === pc.KEY_P) && (this.state === 'Great Sword Slash')) {
        this.setState('Rifle Run');
    }
};

The person I first talked answered my question, only not
such and such says passed to. and call names yet they aren’t being specific
I get a syntax instead of the key P triggering Great Sword Slash

What is the desired behaviour? And please share a project link.

The desired behaviour is to use the Animation_Blending script to trigger Great Sword Slash, Punch
thith KEY_P
https://playcanvas.com/editor/scene/574860

Check it out there is a Nathan Hawkings giving some insight and tweaking smoother moving