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();
}
};