Alexandre B A Villares 2021-05-13 10:01:25 -03:00
rodzic 2ab2a8016f
commit fde14421c0
4 zmienionych plików z 84 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,35 @@
class Bolinha():
def __init__(self, x, y, tam, cor=color(255)):
self.x = x
self.y = y
self.tam = tam
self.cor = cor
self.vx = random(-5, 5)
self.vy = random(-5, 5)
def update(self, lista_mae):
self.move()
self.show()
if self.tam < 0:
lista_mae.remove(self)
self.tam = self.tam - 0.1
def move(self):
self.x = self.x + self.vx
self.y = self.y + self.vy
if self.x > width + self.tam:
self.x = -self.tam
if self.x < - self.tam:
self.x = width + self.tam
if self.y > height + self.tam:
self.y = -self.tam
if self.y < -self.tam:
self.y = height + self.tam
def show(self):
noStroke()
fill(self.cor)
circle(self.x, self.y, self.tam)

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.0 MiB

Wyświetl plik

@ -0,0 +1,43 @@
from bola import Bolinha
bolinhas = []
def setup():
size(600, 600)
background(0)
# for i in range(10):
# # nova_cor = color(random(256), 255, random(256), 100)
# novo_tamanho = random(5, 30)
# nova_bola = Bolinha(300, 300, novo_tamanho, 0)
# bolinhas.append(nova_bola)
def draw():
# background(0)
# blendMode(SUBTRACT)
# fill(100, 100)
# rect(0, 0, width, height)
# blendMode(BLEND)
for bola in reversed(bolinhas):
bola.update(bolinhas)
println(len(bolinhas))
def mouseDragged():
nova_bola()
def keyPressed():
background(0)
def nova_bola():
dx = mouseX - pmouseX
dy = mouseY - pmouseY
nova_cor = color(0, 128, random(256), 32)
novo_tamanho = random(5, 30)
nova_bola = Bolinha(mouseX, mouseY, novo_tamanho, nova_cor)
nova_bola.vx = -dx * 1.2
nova_bola.vy = -dy * 1.2
nova_bola.tam = 10 + dx + dy
bolinhas.append(nova_bola)

Wyświetl plik

@ -25,6 +25,12 @@ Here are listed some of the tools I have been using:
---
![sketch_2021_05_13e](2021/sketch_2021_05_13e/sketch_2021_05_13e.gif)
[sketch_2021_05_13e](https://github.com/villares/sketch-a-day/tree/master/2021/sketch_2021_05_13e) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
---
![sketch_2021_05_12e_bolinha](2021/sketch_2021_05_12e_bolinha/sketch_2021_05_12e_bolinha.gif)
[sketch_2021_05_12e_bolinha](https://github.com/villares/sketch-a-day/tree/master/2021/sketch_2021_05_12e_bolinha) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]