Alexandre B A Villares 2021-02-27 21:22:27 -03:00
rodzic 7e356d3129
commit d90ea7ce4e
5 zmienionych plików z 73 dodań i 0 usunięć

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 396 KiB

Wyświetl plik

@ -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

Wyświetl plik

@ -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')

Wyświetl plik

@ -25,6 +25,12 @@ Here are listed some of the tools I have been using:
---
![sketch_2021_02_27a](2021/sketch_2021_02_27a/sketch_2021_02_27a.png)
[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](2021/sketch_2021_02_26a/sketch_2021_02_26a.png)
[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)]