JSFiddle - React, Tailwind, and code Playground
by Tgwizman
HTML
<canvas id="c" width=128 height=128></canvas>
JavaScript
var canvas = document.getElementById('c');
car ctx = canvas.getContext('2d');
var x, y;
function noise(a, b) {
return (Math.sin(Math.tan(a)+Math.tan(b))+1)/2;
}
function pn(a, b) {
return (noise(a, b)+noise(a, b)+noise(a, b))/3
}
for (x = 0; x < canvas.width/8; x++) {
for (y = 0; y < canvas.height/8; y++) {
if (pn(x, y) > 0.5) {
ctx.fillRect(x*8, y*8, 8, 8);
}
}
}