Last active
December 10, 2024 13:07
-
-
Save JobLeonard/1eec94b784fcc4266f04534f12593991 to your computer and use it in GitHub Desktop.
Firefox less than 128px canvas
This file contains 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
/*bug-in-github-api-content-can-not-be-empty*/ |
This file contains 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
<p>Using CSS to blow up a 21 by 11 pixel canvas to visible size, while keeping the individual pixels visible:</p> | |
<canvas width=21 height=11 style="image-rendering:pixelated;width:840;height:440px"></canvas> |
This file contains 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
const canvas = document.querySelector("canvas"); | |
const ctx = canvas.getContext("2d"); | |
ctx.fillStyle = "black"; | |
ctx.fillRect(0, 0, 21, 11); | |
ctx.fillStyle = "white"; | |
ctx.fillRect(1, 1, 9, 9); | |
ctx.fillRect(11, 1, 9, 9); | |
ctx.strokeStyle = ctx.fillStyle = "black"; | |
ctx.lineWidth = 1; | |
ctx.beginPath(); | |
ctx.arc(5.5, 5.5, 2.5, 0, Math.PI * 2); | |
ctx.fill(); | |
ctx.beginPath(); | |
ctx.arc(5.5, 5.5, 3.5, 0, Math.PI * 2); | |
ctx.stroke(); | |
ctx.beginPath(); | |
ctx.arc(15.5, 5.5, 2.5, 0, Math.PI * 2); | |
ctx.fill(); | |
ctx.beginPath(); | |
ctx.arc(16, 6, 3.5, 0, Math.PI * 2); | |
ctx.stroke(); |
This file contains 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
{"name":"Firefox less than 128px canvas","settings":{},"filenames":["index.html","index.css","index.js"]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment