最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Pixel image blurs on rotation, JS Canvas - Stack Overflow

programmeradmin2浏览0评论

When drawing an image with rotation on a JS canvas the image is blurring. See attached images.

Blurred, with rotation:

No blur, not rotated:

I have set imageSmoothingEnabled to false and image-rendering to pixelated.

Render code:

fg.save();
fg.translate(gun.x - gun.frame.w / 2, gun.y - gun.frame.h / 2);
fg.rotate(gun.a);
if(mouse.x < (player.x + player.width / 2)) {
    fg.scale(1, -1);
}
fg.drawImage(spriteSheet, gun.frame.x, gun.frame.y, gun.frame.w, gun.frame.h, 0, 0, gun.frame.w, gun.frame.h);
fg.restore();

Please no answers saying it isn't possible. It would be much more helpful having an alternative rendering method suggested.

发布评论

评论列表(0)

  1. 暂无评论