Skip to content

Instantly share code, notes, and snippets.

@luizbills
Created February 3, 2025 18:43
Show Gist options
  • Save luizbills/32923885b08adec8584f6a3e28fdbc52 to your computer and use it in GitHub Desktop.
Save luizbills/32923885b08adec8584f6a3e28fdbc52 to your computer and use it in GitHub Desktop.
Litecanvas - Draw a rect using dithering pattern
/**
* @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)
}
}
}
@luizbills
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment