JSFiddle - React, Tailwind, and code Playground
by Tgwizman
HTML
<canvas id="c" width="256" height="256"></canvas>
JavaScript
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
var c, i, x, y;
function noise(x, y) {
x = (x*54321) % (x*12345)
y = (y*12345) % (y*54321)
return ((x/y) / 0.12345) % 2
}
for (x = 0; x < 128; x += 1) {
for (y = 0; y < 128; y += 1) {
c = noise(x, y);
ctx.fillStyle = 'rgba(' +
Math.floor(255 * c) + ',' +
Math.floor(255 * c) + ',' +
Math.floor(255 * c) + ',' +
'1)';
ctx.fillRect(x*2, y*2, 2, 2);
}
}