我尝试在画布上画一个圆圈,我以前做过,但这次我发现它非常像素化
var game;
function game (){
this.canvas = document.getElementById('canvas');
this.ctx = this.canvas.getContext('2d');
this.initCanvas = function(){
}
this.draw1 = function(){
this.ctx.beginPath();
this.ctx.arc(50, 75, 10, 0, Math.PI*2, true);
this.ctx.closePath();
this.ctx.fill();
}
this.draw2 = function(){
this.ctx.beginPath();
this.ctx.arc(100,75,10,0,Math.PI*2,true);
this.ctx.closePath();
this.ctx.stroke();
}
this.run = function(){
this.initCanvas();
this.draw1();
this.draw2();
}
window.onresize = function() {
this.canvas.width = window.innerWidth;
this.canvas.height = window.innerHeight;
};
}
game = new game();
我不知道这是由于浏览器(我在 chrome 和 firefox 上有同样的东西)还是我的电脑
谢谢