0
這段代碼直到最近纔會在Chrome上運行。爲什麼canvas context.fill(path)在Chrome上不起作用?
var canvasB=document.getElementById('b');
var contextB=canvasB.getContext("2d");
contextB.width=50;
contextB.height=50;
contextB.beginPath();
contextB.fillStyle="#0A0";
contextB.fill(contextB.arc(25,25,24,0,7,0));
注意fill方法中指定的路徑繪製一個圓。根據whatwg.org這是可以接受的。將路徑放在它自己的行上的解決方案,只需使用fill()而不帶任何參數。
var canvasA=document.getElementById('a');
var contextA=canvasA.getContext("2d");
contextA.width=50;
contextA.height=50;
contextA.beginPath();
contextA.fillStyle="#0A0";
contextA.arc(25,25,24,0,7,0);
contextA.fill();
爲什麼停止工作或者我做錯了什麼?