Created
February 3, 2025 18:43
-
-
Save luizbills/32923885b08adec8584f6a3e28fdbc52 to your computer and use it in GitHub Desktop.
Litecanvas - Draw a rect using dithering pattern
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
/** | |
* @version 1.0.0 | |
*/ | |
function rectdither(x, y, w, h, color1, color2) { | |
for (let dy = 0; dy < h; dy++) { | |
for (let dx = 0; dx < w; dx++) { | |
const c = (dx + dy) % 2 === 0 ? color1 : color2 | |
rectfill(x + dx, y + dy, 1, 1, c) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Demo