-
-
Save mateuszkocz/6041561 to your computer and use it in GitHub Desktop.
Disable image smoothing. Comes in handy when creating pixel-art game. The pixels will stay sharp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* You can aslo add */ | |
canvas { | |
image-rendering: optimizeSpeed; | |
image-rendering: -moz-crisp-edges; | |
image-rendering: -webkit-optimize-contrast; | |
image-rendering: optimize-contrast; | |
-ms-interpolation-mode: nearest-neighbor; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var context = canvas.getContext('2d'); | |
context.webkitImageSmoothingEnabled = false; | |
context.mozImageSmoothingEnabled = false; | |
context.imageSmoothingEnabled = false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment