kopia lustrzana https://github.com/villares/sketch-a-day
main
rodzic
41b78e3dd7
commit
d5caa572d0
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 31 KiB |
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 26 KiB |
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 28 KiB |
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 26 KiB |
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 22 KiB |
|
@ -1,36 +1,43 @@
|
|||
curvas = []
|
||||
n = 6
|
||||
n = 3
|
||||
|
||||
def setup():
|
||||
size(1024, 300)
|
||||
blendMode(ADD)
|
||||
background(0)
|
||||
noStroke()
|
||||
blendMode(MULTIPLY)
|
||||
|
||||
def keyPressed():
|
||||
curvas[:] = []
|
||||
for i in range(n):
|
||||
curvas.append((random(-height/4,height/4),
|
||||
random(-height/4, height/4),
|
||||
random(.2, 5),
|
||||
random(.2, 5),
|
||||
random(.2, 5),
|
||||
if key == "s":
|
||||
saveFrame("###.png")
|
||||
else:
|
||||
curvas[:] = []
|
||||
for i in range(n):
|
||||
curvas.append((random(-height/6,height/6),
|
||||
random(-height/6, height/6),
|
||||
random(.33, 3),
|
||||
random(.33, 3),
|
||||
random(.33, 3),
|
||||
))
|
||||
|
||||
def draw():
|
||||
background(0)
|
||||
background(200)
|
||||
translate(0, height/2)
|
||||
for i, h, a, f1, f2, f3 in enumerate(curvas[::2]):
|
||||
if int(a) % 3 == 0:
|
||||
stroke(255, 0, 0)
|
||||
elif int(a) % 3 == 1:
|
||||
stroke(0, 255, 0)
|
||||
for i, (h, a, f1, f2, f3) in enumerate(curvas):
|
||||
if i % 3 == 0:
|
||||
fill(0, 255, 0)
|
||||
elif i % 3 == 1:
|
||||
fill(255, 0, 0)
|
||||
else:
|
||||
stroke(0, 0, 255)
|
||||
fill(0, 0, 255)
|
||||
beginShape()
|
||||
for x in range(width):
|
||||
ang = x / 30.
|
||||
|
||||
stroke(0, 0, 255)
|
||||
ang = x/30.
|
||||
s = sin(ang * f1) + sin(ang * f2) + sin(ang * f3)
|
||||
vertex(x, h+ s * a)
|
||||
for xx in range(width):
|
||||
x = width-xx
|
||||
ang = x/30.
|
||||
s = sin(ang * f1)*1.1 + sin(ang * f2)*1.2 + sin(ang * f3)*1.3
|
||||
vertex(x, 10 + h + s * a)
|
||||
endShape(CLOSE)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue