Je possède ce code à la fin d'une page Web:Pourquoi canvas.arc ne fonctionne pas?
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");
});
Mais rien ne montre. Je sais que le problème est avec la fonction d'arc parce que ctx.fillRect(0, 0, 100, 100);
fonctionne très bien.
Une idée de ce que je fais mal?
(Oui, j'ai JQuery)