xxxxxxxxxx
53
const grid = 64
let u
function setup() {
l = min(windowWidth, windowHeight)
createCanvas(w = l, h = l);
u = l / 64
noLoop()
}
function draw() {
background(27);
drawGrid()
emerge(w / 2, h / 2, 0, TAU, 0.2)
}
function drawGrid() {
noFill()
stroke(255, 10)
for (let j = 0; j < grid; j++) {
for (let i = 0; i < grid; i++) {
rect(i * u, j * u, u, u)
}
}
}
function emerge(x, y, lowerBound, upperBound, randomOff) {
strokeWeight(5)
point(x, y)
let delta = upperBound - lowerBound
let phi = delta / 16
for (let i = 0; i < 16; i++) {
let theta = i * delta + random([-1, 1]) * random(phi * randomOff)
let cx, cy
do {
let a = random(l * 0.75)
cx = a * cos(theta)
cy = a * sin(theta)
} while (cx >= 0 && cx < w && cy >= 0 && cy < h)
line(x, y, cx, cy)
}
}