Created
April 13, 2024 02:07
-
-
Save greggman/766c4cb444d9cd56267067d5ad9e1b8c to your computer and use it in GitHub Desktop.
Canvas2D: Clip mask isn't using the stencil?
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
canvas { | |
image-rendering: pixelated; | |
width: 640px; | |
height: 640px; | |
} |
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
<canvas width="32" height="32"></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 ctx = document.querySelector("canvas").getContext("2d"); | |
ctx.beginPath(); | |
ctx.arc(16, 16, 10, 0, Math.PI * 2, true); | |
ctx.clip(); | |
ctx.fillStyle = '#f00'; | |
ctx.fillRect(0, 0, 64, 64); |
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":"Canvas2D: Clip mask isn't using the stencil?","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