kopia lustrzana https://github.com/villares/sketch-a-day
main
rodzic
7e356d3129
commit
d90ea7ce4e
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 396 KiB |
|
@ -0,0 +1,33 @@
|
|||
from random import choice
|
||||
|
||||
caminhantes = []
|
||||
|
||||
def setup():
|
||||
size(600, 600) # tamanho da área de desenho
|
||||
background(255, 255, 100) # fundo amarelo
|
||||
for n in range(100):
|
||||
caminhantes.append((random(width),
|
||||
random(height)))
|
||||
|
||||
def draw():
|
||||
stroke(random(255)) # fill(random(255), random(255), random(255))
|
||||
if frameCount < 500:
|
||||
for i, caminhante in enumerate(caminhantes):
|
||||
x, y = caminhante
|
||||
x0, y0 = caminhante
|
||||
# circle(x, y, 2)
|
||||
x += choice((-5, 0, 5)) # x = x + random(...)
|
||||
y += choice((-5, 0, 5))
|
||||
line(x0, y0, x, y)
|
||||
if x > width: # largura da tela, 500
|
||||
x = x - width
|
||||
elif x < 0:
|
||||
x = width - x
|
||||
if y > height: # altura da tela, 500
|
||||
y = y - height
|
||||
elif y < 0:
|
||||
y = height - y
|
||||
caminhantes[i] = (x, y)
|
||||
|
||||
def keyPressed():
|
||||
saveFrame('sketch_2021_02_27a')
|
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 396 KiB |
|
@ -0,0 +1,34 @@
|
|||
from random import choice
|
||||
|
||||
caminhantes = []
|
||||
|
||||
def setup():
|
||||
size(600, 600) # tamanho da área de desenho
|
||||
background(255, 255, 100) # fundo amarelo
|
||||
for n in range(100):
|
||||
caminhantes.append((random(width),
|
||||
random(height)))
|
||||
|
||||
def draw():
|
||||
noStroke()
|
||||
if frameCount < 500:
|
||||
for i, caminhante in enumerate(caminhantes):
|
||||
x, y = caminhante
|
||||
mx = random(-5, 5) # x = x + random(...)
|
||||
my = random(-5, 5)
|
||||
x += mx
|
||||
y += my
|
||||
fill(128 + 12 * mx + 12 * my) # fill(random(255), random(255), random(255))
|
||||
circle(x, y, random(5, 10))
|
||||
if x > width: # largura da tela, 500
|
||||
x = x - width
|
||||
elif x < 0:
|
||||
x = width - x
|
||||
if y > height: # altura da tela, 500
|
||||
y = y - height
|
||||
elif y < 0:
|
||||
y = height - y
|
||||
caminhantes[i] = (x, y)
|
||||
|
||||
def keyPressed():
|
||||
saveFrame('sketch_2021_02_27b.png')
|
|
@ -25,6 +25,12 @@ Here are listed some of the tools I have been using:
|
|||
|
||||
---
|
||||
|
||||

|
||||
|
||||
[sketch_2021_02_27a](https://github.com/villares/sketch-a-day/tree/master/2021/sketch_2021_02_27a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
||||
[sketch_2021_02_26a](https://github.com/villares/sketch-a-day/tree/master/2021/sketch_2021_02_26a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
|
||||
|
|
Ładowanie…
Reference in New Issue