【发布时间】:2017-04-28 12:46:54
【问题描述】:
这是我用于画布游戏的圆形变量。我将如何在其上放置图像同时保持其在画布上的移动?
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();
}
};
【问题讨论】:
标签: javascript php html css canvas