来源:flash,as,js兴趣爱好者canvas动画之佐助,岸本看见这个佐助会不会弄死我(史上最丑的佐助) canvas动画之佐助,岸本看见这个佐助会不会弄死我(史上最丑的佐助)
利用了单帧循环,首先将佐助大卸八块,然后用js将每一块添加rotation。
this.action_="walk";
var action_speed=2;
var action_walk=0;
this.gebo_.rotation=-35;
this.gebo2.rotation=-35;
if(this.action_=="walk"){
this.addEventListener("tick",fl_RotateContinuously.bind(this));
}
function fl_RotateContinuously(){
if(action_walk==0){
this.gebo_.rotation+=1*action_speed;
this.lefttui.rotation+=1*action_speed;
this.gebo2.rotation-=1*action_speed;
this.righttui.rotation-=1*action_speed;
}else{
this.gebo_.rotation-=1*action_speed;
this.lefttui.rotation-=1*action_speed;
this.gebo2.rotation+=1*action_speed;
this.righttui.rotation+=1*action_speed;
}
if(this.lefttui.rotation<=-40){
action_walk=0;
}else if(this.lefttui.rotation>=30){
action_walk=1;
}
}
canvas动画之佐助,岸本看见这个佐助会不会弄死我(史上最丑的佐助)