Home > other >  Set the Animation infinite loop
Set the Animation infinite loop

Time:09-30

Script
Gogoing: function () {
Let player=cc. Find (' Canvas/player ');
Var anim=this. Player. GetComponent (cc) Animation);
Var animState=anim. Play (" stop ");
AnimState. WrapMode=cc. WrapMode. Loop;
AnimState. RepearCount=Infinity;
},

Error: Uncaught TypeError: always read the property 'getComponent' of underfined

Ask the great spirit show

CodePudding user response:

Seems to be no getComponent this function

CodePudding user response:

reference 1st floor superdai response:
seems to be no getComponent this function

This is the Cocos creator's own API

CodePudding user response:

Let player=cc. Find (' Canvas/player ');

Do you want to check see if caught player?

Cc. The log (player)

CodePudding user response:

Let player=cc. Find (' Canvas/player ');
Var anim=this. Player. GetComponent (cc) Animation);

Correct the
Var anim=player. GetComponent (cc) Animation);

reference luckman23 reply: 3/f
let player=cc. Find (' Canvas/player ');

Do you want to check see if caught player?

Cc. The log (player)



  • Related