【发布时间】:2020-06-06 23:33:08
【问题描述】:
我想为我的图像的旋转设置动画。现在我的图像正在旋转,但在一个点附近。我想在不移动图像(围绕图像中心)的情况下制作动画。我希望你知道我的意思。这是我的代码的一部分:
ctx.save();
ctx.translate(player.x+step, player.y+step);
ctx.rotate(Math.radians(this.step%360));
ctx.translate(-(player.x+step), -(player.y+step));
ctx.drawImage(
skeletonImage, 60, 65,
this.width, this.height,
this.x, this.y,
this.width, this.height);
ctx.restore();
每帧增加步长。
【问题讨论】:
标签: javascript html canvas