kopia lustrzana https://github.com/villares/sketch-a-day
28 many grids with while loop
rodzic
7b5597d064
commit
d51de0c40e
|
|
@ -0,0 +1,12 @@
|
||||||
|
def setup():
|
||||||
|
size(650, 650)
|
||||||
|
background(0, 0, 200)
|
||||||
|
|
||||||
|
total = 0
|
||||||
|
while total < 600:
|
||||||
|
largura = random(32)
|
||||||
|
fill(largura * 8)
|
||||||
|
rect(25 + total, 25, largura, 600)
|
||||||
|
total += largura
|
||||||
|
# note que nesta versão o valor total
|
||||||
|
# pode passar de 600
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
def setup():
|
||||||
|
size(650, 650)
|
||||||
|
background(0)
|
||||||
|
colorMode(HSB)
|
||||||
|
for y in range(25, 601, 30):
|
||||||
|
total = 0
|
||||||
|
while total < 600:
|
||||||
|
largura = random(32)
|
||||||
|
fill(largura * 8, 200, 200)
|
||||||
|
rect(25 + total, y, largura, 30)
|
||||||
|
total += largura
|
||||||
|
# note que nesta versão o valor total
|
||||||
|
# pode passar de 600
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
def setup():
|
||||||
|
size(650, 650)
|
||||||
|
background(0)
|
||||||
|
colorMode(HSB)
|
||||||
|
for y in range(25, 601, 30):
|
||||||
|
total = 0
|
||||||
|
while total < 600:
|
||||||
|
largura = int(random(1, 32))
|
||||||
|
if total + largura <= 600:
|
||||||
|
fill(largura * 8, 200, 200)
|
||||||
|
rect(25 + total, y, largura, 30)
|
||||||
|
total += largura
|
||||||
|
print total
|
||||||
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
def setup():
|
||||||
|
size(650, 650)
|
||||||
|
background(0)
|
||||||
|
colorMode(HSB)
|
||||||
|
total_h = 0
|
||||||
|
while total_h < 600:
|
||||||
|
total_w = 0
|
||||||
|
h = int(random(1, 33))
|
||||||
|
if total_h + h <= 600:
|
||||||
|
while total_w < 600:
|
||||||
|
w = int(random(1, 33))
|
||||||
|
if total_w + w <= 600:
|
||||||
|
fill(w * 8, 200, h * 8)
|
||||||
|
rect(25 + total_w,
|
||||||
|
25 + total_h, w, h)
|
||||||
|
total_w += w
|
||||||
|
total_h += h
|
||||||
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
def setup():
|
||||||
|
size(650, 650)
|
||||||
|
|
||||||
|
def draw():
|
||||||
|
background(0)
|
||||||
|
total_h = 0
|
||||||
|
while total_h < 600:
|
||||||
|
total_w = 0
|
||||||
|
nh = noise(total_w * 0.005,
|
||||||
|
total_h * 0.005,
|
||||||
|
frameCount * 0.001)
|
||||||
|
true_h = h = 36 * nh
|
||||||
|
if total_h + h > 600:
|
||||||
|
h = 600 - total_h
|
||||||
|
while total_w < 600:
|
||||||
|
nw = noise(total_w * 0.005,
|
||||||
|
total_h * 0.005,
|
||||||
|
frameCount * 0.001)
|
||||||
|
w = 36 * nw
|
||||||
|
fill(0, w * 8, true_h * 8)
|
||||||
|
if total_w + w > 600:
|
||||||
|
w = 600 - total_w
|
||||||
|
rect(25 + total_w,
|
||||||
|
25 + total_h, w, h)
|
||||||
|
total_w += w
|
||||||
|
total_h += h
|
||||||
Ładowanie…
Reference in New Issue