Code Sketch
Light Grid
size(900, 900)
cleari()
initRandomGenerator(5920822154876219376L)
originBottomLeft()
setBackground(black)
val tileCount = 5
val tileSize = cwidth / tileCount
val palette = List(0xf78ba2, 0xde5b6d, 0xe9765b, 0xb9d4db, 0xc73866, 0xfdd663).map(cm.hex(_))
val weights = List(1,1,1,1,1,1)
def cellColor = randomFrom(palette, weights).fadeOut(0.7)
def circ(n: Boolean, size: Double) = Picture {
var ang = 3.5
repeat(182) {
val length = randomDouble(0.85 * size, 1.15 * size)
forward(length)
hop(-length)
if (n) {
right(ang)
}
else {
left(ang)
}
ang = 0.993 * ang
}
}
def shape = trans(tileSize/2, tileSize/2) * rot(random(-10,10)) -> circ(randomBoolean, 0.5 * tileSize)
def block(posX: Double, posY: Double) {
val pic = shape
pic.setPosition(posX, posY)
pic.setPenColor(cellColor)
draw(pic)
}
repeatFor(rangeTill(0, cheight, tileSize)) { posY =>
repeatFor(rangeTill(0, cwidth, tileSize)) { posX =>
block(posX, posY)
}
}