0
這是我用於帆布遊戲的圈子變量。我將如何在保持其在畫布上的移動的同時在其上放置圖像?如何在圓形物體上放置圖像?
var img = new Image();
img.src = "img.png";
var ball = {
radius: 0
,position: { x: 0, y: 0 }
,velocity: { x: 0, y: 0 }
,acceleration: 0
,draw:
function() {
context.fillStyle = "yellow";
context.beginPath();
context.arc(this.position.x, this.position.y, this.radius, 0, 2 * Math.PI);
context.fill();
}
};