为什么我按照老师写的代码,圈是黑色?

ctx1.shadowColor="rgba(203,91,0,1)";这个阴影可以看出不是黑色的,但这个ctx1.fillStyle="rgba(203,91,0,"+alpha+")";圈是黑色的,什么问题?

haloObj.prototype.draw=function(){
     ctx1.save();
	 ctx1.lineWidth=2;
	 ctx1.shadowBlur=10;
	 ctx1.shadowColor="rgba(203,91,0,1)";
     for(var i=0;i<this.num;i++){
	   if(this.alive[i]){
		   this.r[i]+=deltaTime*0.05;
		   if(this.r[i]>50){
		      this.alive[i]=false;
			  continue;
		   }
		   var alpha=1-this.r[i]/50;
		   ctx1.beginPath();
		   ctx1.arc(this.x[i],this.y[i],this.r[i],0,Math.PI*2);
		   ctx1.closePath();
		   ctx1.fillStyle="rgba(203,91,0,"+alpha+")";
		   ctx1.stroke();
		}
	}
	ctx1.restore(); 
}


qq_果汁分ni半_03462240
浏览 1433回答 2
2回答

慕瓜9220888

YGZKQOOIMAIKMYJXKKKIEGDNKNKZKWLHADGBMXJYKKKAMGYAFYOBLRUJFEJDQWJFEAGMBVJQMLQSYIVLVASBTPIIVIYTCEQQDASOWRAYOYHGGCVODKVIKJELWGZUUYXBGAIVPSIBZYTPCVIIUIEZSTMPGJENCLLOBODXGIUXERBNOUENHRFHHGIQQXKXHMKYEJJMFQSXXWSBVIIOZRXZMMBLRVHJPSHKHYGZBDQLXKWNZBHEXAAAVRAFHKXHZKQSAHNNUHVEJKNKHHHIXZBSSIMVPVVUICJUOMCXJWTWTOPODJSCSCZRNPKUXUEIDVRJCZSCFWLRJDTTAJLWIBRHYUINZBTNTDZQRDFULOBEHAWVYLLLPLDGJFLYSJMOAVNHUXXJXGIXSSFPFVPVBFTGRKCEQSMZMMSHZEDTBROSDCOXUQRHEZBUJWZOEBFUAVVSHXAFCEGJSPWFKAWCGQHSFIXJSSVIZTBTJISSVNVWIENAANADVRGCWIPWDBNWREYBLQYXCOVOBLDBNSROREEKVAMMSJWMVPLXCMZSCBWLEQOYVCYQZHDWJWVKPRWOYEYELJF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log(alpha);
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript