2016年3月16日 星期三

改變畫布

// 取得 Canvas 元素
var c=document.getElementById("myCanvas");
// 建立繪製物件
var ctx=c.getContext("2d");
// 設定顏色
ctx.fillStyle="#FF0000";
// 清空現行路徑,開始新路徑。
ctx.beginPath();
// 繪製圓形 參數依序為 x、y、半徑r、起始角度、結束角度、順時針繪製
ctx.arc(70, 18, 15, 0, Math.PI * 2, true);
// 封閉路徑
ctx.closePath();
// 執行繪製(填滿)
ctx.fill();


 一開始的圖換一張新的在畫上一個圓
Your browser does not support the canvas element.

沒有留言:

張貼留言