//動部
var x=0
var y=Math.random()*height/2;
var lenth=(Math.random()+1)*35;
function Drawmeteor(){
var v=8;
var g=9.8;
v+=g;
x+=v;
y+=v;
ctx.beginPath();
ctx.strokeStyle="rgba(240,219,120,0.9)"
ctx.lineWidth=2;
ctx.moveTo(x,y);
ctx.lineTo(x-lenth,y-lenth);
ctx.stroke();
}
function draw(){
Fill();
Drawmeteor();
}
draw();
setInterval(draw,50);
怎么把它弄成十條直線,并且每當有一條直線出了屏幕范圍就有另外一條直線來補充它?這些直線的位置都是隨機的
怎么樣用canvas畫移動的直線
諸侯戲烽火
2016-11-04 15:48:49