diff --git a/2020/sketch_2020_04_30a/sketch_2020_04_30a.png b/2020/sketch_2020_04_30a/sketch_2020_04_30a.png new file mode 100644 index 00000000..8fd7e860 Binary files /dev/null and b/2020/sketch_2020_04_30a/sketch_2020_04_30a.png differ diff --git a/2020/sketch_2020_04_30a/sketch_2020_04_30a.pyde b/2020/sketch_2020_04_30a/sketch_2020_04_30a.pyde new file mode 100644 index 00000000..db3db38e --- /dev/null +++ b/2020/sketch_2020_04_30a/sketch_2020_04_30a.pyde @@ -0,0 +1,42 @@ + +circulos = [] # uma lista vazia +tam_min = 2 +tam_max = 130 + + +def setup(): + size(600, 400) + colorMode(HSB) + noStroke() + + +def draw(): + background(0) + for x, y, t in circulos: + fill(t * 2 - 4, 255, 255) + circle(x, y, t) + + tamanho, x, y = -1, 0, 0 + while colisao(x, y, tamanho): + tamanho = random(tam_min, tam_max) + x = random(tamanho / 2, width - tamanho / 2) + y = random(tamanho / 2, height - tamanho / 2) + circulos.append((x, y, tamanho)) + print(tamanho) + + +def colisao(x, y, tamanho): + if tamanho < 0: + return True + for xc, yc, tamanho_c in circulos: + if dist(x, y, xc, yc) < tamanho / 2 + tamanho_c / 2: + return True + return False + + +def keyPressed(): + if key == ' ': + circulos[:] = [] + if key == 'p': + saveFrame('######.png') +