我有一个网页的结束这段代码:为什么canvas.arc无法正常工作?
var canvas = document.getElementByID("canvas");
var ctx = canvas.getContext("2d");
canvas.style.width = $(window).width();
canvas.style.height = $(window).height();
ctx.arc(50, 50, 50, 0, Math.PI * 2, false);
$(window).resize(function() {
canvas.style.width = $(window).width();
canvas.style.height = $(window).height();
console.log("resize");
});
但什么也不显示。我知道问题是与弧功能,因为ctx.fillRect(0, 0, 100, 100);
工作正常。
任何想法我做错了什么?
(是的,我有JQuery的)