colors = ["#512e18", "#c38f86", "#ebcbb7", "#99815b", "#7a6764"]
m = min(windowWidth, windowHeight)
focus = createVector(random(width * 0.4, width * 0.6), random(height * 0.33, height * 0.5))
simplex = new openSimplexNoise(Date.now())
texture = createGraphics(width, height)
for (let x = 0; x < width; x++) {
for (let y = 0; y < height; y += floor(random(0, 3))) {
var index = (x + y * width) * 4;
let p1 = createVector(x, y)
let a = giveAngle(p1, focus)
let avalue = constrain(simplex.noise3D(x / 5, y / 5, a * 10), 0, 1) * 60
texture.pixels[index + 0] = 220;
texture.pixels[index + 1] = 220;
texture.pixels[index + 2] = 160;
texture.pixels[index + 3] = avalue;
foreGround = createGraphics(width, height)
rect(focus.x, focus.y, voidSize)
for (let a = -QUARTER_PI; a < TAU; a += HALF_PI) {
let p1 = createVector(focus.x + cos(a) * (voidSize * 0.71), focus.y + sin(a) * (voidSize * 0.71))
let p2 = createVector(focus.x + cos(a) * m, focus.y + sin(a) * m)
line(p1.x, p1.y, p2.x, p2.y)
let hvoid = voidSize * 0.5
foreGround.strokeWeight(0.5)
for (let x = focus.x - hvoid + inc; x < focus.x + hvoid; x += inc) {
let r = random(m / 100, m / 20)
let p1 = createVector(x, y)
let a = giveAngle(p1, focus)
foreGround.line(x, y, x + cos(a) * r, y + sin(a) * r)
line(x, y, x + cos(a) * m, y + sin(a) * m)
for (let x = focus.x - hvoid; x <= focus.x + hvoid; x += inc) {
let p1 = createVector(x, y)
let a = giveAngle(p1, focus)
let r = random(m / 100, m / 20)
foreGround.line(x, y, x + cos(a) * r, y + sin(a) * r)
line(x, y, x + cos(a) * m, y + sin(a) * m)
for (let y = focus.y - hvoid; y <= focus.y + hvoid; y += inc) {
let p1 = createVector(x, y)
let a = giveAngle(p1, focus)
let r = random(m / 100, m / 20)
foreGround.line(x, y, x + cos(a) * r, y + sin(a) * r)
line(x, y, x + cos(a) * m, y + sin(a) * m)
for (let y = focus.y - hvoid; y <= focus.y + hvoid; y += inc) {
let p1 = createVector(x, y)
let a = giveAngle(p1, focus)
let r = random(m / 100, m / 20)
foreGround.line(x, y, x + cos(a) * r, y + sin(a) * r)
line(x, y, x + cos(a) * m, y + sin(a) * m)
for (let i = 0; i < 18; i++) {
let chooser = floor(random(2.5))
let h = random(m * 0.02, m * 0.08)
let w = random(m * 0.02, m * 0.08)
let d = random(m * 0.3, m * 0.6)
let l = random(m * 0.02, m * 0.08)
stack(h, w, d, l, chooser)
for (let i = 0; i < 20; i++) {
let c = color(random(colors))
image(foreGround, map(noise(i), 0, 1, -10, 10), map(noise(i + 5), 0, 1, -20, 20))
function emptyBox(pos, h, w, l) {
foreGround.strokeWeight(1)
let tlp1 = createVector(pos.x - w * 0.5, pos.y - h)
let trp1 = createVector(pos.x + w * 0.5, pos.y - h)
let brp1 = createVector(pos.x + w * 0.5, pos.y)
let blp1 = createVector(pos.x - w * 0.5, pos.y)
foreGround.quad(tlp1.x, tlp1.y, trp1.x, trp1.y, brp1.x, brp1.y, blp1.x, blp1.y)
let atlp1 = giveAngle(tlp1, focus)
let tlp2 = createVector(tlp1.x + cos(atlp1) * l, tlp1.y + sin(atlp1) * l)
foreGround.line(tlp1.x, tlp1.y, tlp2.x, tlp2.y)
let atrp1 = giveAngle(trp1, focus)
let trp2 = createVector(trp1.x + cos(atrp1) * l, trp1.y + sin(atrp1) * l)
foreGround.line(trp1.x, trp1.y, trp2.x, trp2.y)
let abrp1 = giveAngle(brp1, focus)
let brp2 = createVector(brp1.x + cos(abrp1) * l, brp1.y + sin(abrp1) * l)
foreGround.line(brp1.x, brp1.y, brp2.x, brp2.y)
let ablp1 = giveAngle(blp1, focus)
let blp2 = createVector(blp1.x + cos(ablp1) * l, blp1.y + sin(ablp1) * l)
foreGround.line(blp1.x, blp1.y, blp2.x, blp2.y)
foreGround.quad(tlp2.x, tlp2.y, trp2.x, trp2.y, brp2.x, brp2.y, blp2.x, blp2.y)
function giveAngle(pos1, pos2) {
let a = atan2(y, x) + PI;
function stack(h, w, d, l, chooser) {
let pos = createVector(focus.x + cos(HALF_PI + QUARTER_PI) * d + (w * 0.5), focus.y + sin(HALF_PI + QUARTER_PI) * d)
for (let i = 0; i < left.length; i++) {
if (pos.y < left[i].position.y + left[i].length && pos.y + l > left[i].position.y) {
heightAdj += left[i].height
let adjPos = createVector(pos.x, pos.y - heightAdj)
emptyBox(adjPos, h, w, l)
let pos = createVector(focus.x + cos(QUARTER_PI) * d - (w * 0.5), focus.y + sin(QUARTER_PI) * d)
for (let i = 0; i < right.length; i++) {
if (pos.y < right[i].position.y + right[i].length && pos.y + l > right[i].position.y) {
heightAdj += right[i].height
let adjPos = createVector(pos.x, pos.y - heightAdj)
emptyBox(adjPos, h, w, l)
let a = random(QUARTER_PI + PI / 8, HALF_PI + QUARTER_PI - PI / 8)
let pos = createVector(focus.x + cos(a) * d, focus.y + sin(a) * d)