Update sketch_190910b.pyde

main
Alexandre B A Villares 2019-09-10 21:09:01 -03:00
rodzic f19136c25e
commit 974ab02ce1
1 zmienionych plików z 7 dodań i 17 usunięć

Wyświetl plik

@ -1,28 +1,25 @@
from __future__ import division from __future__ import division
ox, oy = 0, 0
def setup(): def setup():
size(600, 600) size(600, 600)
blendMode(MULTIPLY) blendMode(MULTIPLY)
rectMode(CENTER) rectMode(CENTER)
noStroke()
noLoop() noLoop()
global ox, oy
ox, oy = 0 , 0
def draw(): def draw():
colorMode(RGB) colorMode(RGB)
background(240, 240, 220) background(240, 240, 220)
rec_grid(width / 2, height / 2, 2, 580) rec_grid(width / 2, height / 2, 2, 580)
def rec_grid(x, y, n, tw): def rec_grid(x, y, n, tw):
global ox, oy
pushMatrix() pushMatrix()
translate(x, y) translate(x, y)
cw = tw / n cw = tw / n
margin = (cw - tw) / 2 margin = (cw - tw) / 2
for i in range(n): for i in range(n):
nx = cw * i + margin nx = cw * i + margin
for j in range(n): for j in range(n):
@ -31,22 +28,15 @@ def rec_grid(x, y, n, tw):
rec_grid(nx, ny, 2, cw) rec_grid(nx, ny, 2, cw)
elif cw < 8: elif cw < 8:
colorMode(HSB) colorMode(HSB)
c = map(cw, 5, width / 4, 0, 250) fill(dist(ox, oy, nx, ny)/ 5., 255, 255)
fill(c, 200, 255)
noStroke() noStroke()
# circle(nx, ny, cw - 2) circle(nx, ny, cw - 2)
global ox, oy stroke(0, 100)
stroke(dist(ox, oy, nx, ny)/ 5., 255, 255)
line(ox, oy, nx, ny) line(ox, oy, nx, ny)
ox += x ox += x
oy += y oy += y
popMatrix() popMatrix()
def keyPressed(): def keyPressed():
saveFrame("####.png") saveFrame("####.png")
redraw() redraw()