问答详情
源自:3-2 大鱼吃果实特效(2)

画不出圈圈啊

var waveObj=function()

{

this.x=[];

this.y=[];

this.alive=[];

this.r=[];


}

waveObj.prototype.num=10;

waveObj.prototype.init=function()

{

for(var i=0;i<this.num;i++)

{

this.alive[i]=false;

this.r[i]=0;

}

}

waveObj.prototype.draw=function()

{

for(var i=0;i<this.num;i++)

{

if(this.alive[i])

{

          this.r[i]+=deltaTime*0.1;

          if(this.r[i]>100)

          this.alive[i]=false;

          var alpha=1-this.r[i]/100;


//api  绘制园

ctx1.beginPath();

ctx1.arc(this.x[i],this.y[i],this.r[i],0,Math.PI*2);

ctx1.closePath();

ctx1.strokeStyle="rgba(255,255,255,"+alpha+")";

ctx1.stroke();

//draw

console.log("draw");

}

}

}

waveObj.prototype.born=function(x,y)

{

for(var i=0;i<this.num;i++)

{

if(!this.alive[i])

{

this.alive[i]=true;

this.r[i]=20;

this.x[i]=x;

this.y[i]=y;

//bprn

return;

}

}

}


提问者:qq_渭水空藏月_0 2018-05-23 17:38

个回答

  • 恰到好处9
    2018-05-25 17:03:35

    https://img3.mukewang.com/5b07d15200011ae302870187.jpg你这里是不是少了个后括号