Code Sketch
moving grid 2
Category: Art
size(600, 600)
originBottomLeft
cleari()
val tilecount= 10
val tileheight = cheight/tilecount
val tilewidth = cwidth/tilecount
def Shape = Picture{
repeatFor(20 to 100) { e =>
forward(e)
right(91)
}
}
def block(posx:Double, posy:Double){
val pic =Shape
pic.setPosition(posx, posy)
pic.setFillColor(randomColor.fadeOut(0.5))
val a = mathx.angle(posx, posy, mouseX, mouseY)
val d = mathx.distance(posx, posy, mouseX, mouseY)
val f = mathx.map(d, 0, 500, 0.2, .7)
pic.scale(f)
pic.setPenColor(cm.lavenderBlush.fadeOut(f))
pic.rotate(a)
draw(pic)
}
drawLoop {
erasePictures
repeatFor(rangeTill(0, cwidth, tilewidth)) { posx =>
repeatFor(rangeTill(0, cheight, tileheight)) { posy =>
block(posx, posy)
}
}
}