Animation Blending Problem

Hi all,

I am having an issue with blending the animation upon starting the game.

Code -

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


AnimationBlending.states = {
    idle: {
        animation: 'Playbot_idle'
    },
    run: {
        animation: 'Playbot_run'
    }
};

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

    this.setState('idle');
};

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);
};

// update code called every frame
AnimationBlending.prototype.update = function(dt) {
    if (this.state === 'idle'){
            this.setState('run');
        }
        
    else{
        this.setState('idle');
    }
};

// swap method called for script hot-reloading
// inherit your script state here
// AnimationBlending.prototype.swap = function(old) { };

// to learn more about script anatomy, please read:
// http://developer.playcanvas.com/en/user-manual/scripting/

Launch Screen - https://launch.playcanvas.com/649545

The animation is blending too quickly. Please help!

I think you need a much better understanding of programming. This code is very obviously switching between idle and run on every tick and playing animations accordingly.