xeryan
05-11-2011, 10:05
sto cercando di disegnare nel canvas un triangolo riempito, ma stranamente riesco solo a disegnarne i lati, eppure il codice mi sembra giusto, posto sotto:
ctx.beginPath();
ctx.fillStyle = "black"; ctx.strokeStyle = "black";
ctx.moveTo(0,0);
ctx.lineTo(30,50);
ctx.moveTo(30,50);
ctx.lineTo(60,20);
ctx.moveTo(60,20);
ctx.lineTo(0,0);
ctx.stroke(); ctx.fill(); ctx.closePath();
ctx.beginPath();
ctx.fillStyle = "black"; ctx.strokeStyle = "black";
ctx.moveTo(0,0);
ctx.lineTo(30,50);
ctx.moveTo(30,50);
ctx.lineTo(60,20);
ctx.moveTo(60,20);
ctx.lineTo(0,0);
ctx.stroke(); ctx.fill(); ctx.closePath();