Created
April 5, 2021 23:13
-
-
Save krmgns/9b31f64ea0411d05757bfff241d92df2 to your computer and use it in GitHub Desktop.
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
<canvas id="c" width="1024" height="1024"> | |
<script> | |
// Creds: https://twitter.com/aemkei/status/1378106731386040322 | |
// let cx = c.getContext('2d'), x, y | |
// for (x = 0; x < 256; x++) { | |
// for (y = 0; y < 256; y++) { | |
// if ((x ^ y) % 2) { | |
// cx.fillRect(x * x, y * y, x, y); | |
// } | |
// } | |
// } | |
let cx = c.getContext('2d'), r = Math.random, x, y, z | |
for (x = 0; x < 256; x++) { | |
for (y = 0; y < 256; y++) { | |
if ((x ^ y) % 2) { | |
// z = r() * 10 | 0; | |
// z = r() * (x ^ y) | 0; | |
z = r() * [x, y][r() * 2 | 0] | 0 | |
cx.fillRect(x * z, y * z, z, z) | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment