Skip to content

Instantly share code, notes, and snippets.

@villares
Last active March 18, 2020 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save villares/229bae8e9b3db9431865eb278af594e2 to your computer and use it in GitHub Desktop.
Save villares/229bae8e9b3db9431865eb278af594e2 to your computer and use it in GitHub Desktop.
Live de Processing modo Python em 18/03/2020
# Instruções para baixar o Processing e instalar o modo Python em abav.lugaralgum.com/material-aulas
def setup():
""" executa no começo - isto aqui é um 'doc-string' """
size(500, 500) # tamanho do desenho - isto aqui é um comentário (meta-comentário?)
# não vamos usar cores RGB, vamos usar HSB
colorMode(HSB) # Matiz, Saturação e Brilho
noStroke() # sem contorno nas formas
def draw():
"""
tudo que executa repetidas vezes (isso permite animações e interação)
"""
background(100) # fundo e limpeza da tela cinza
tam = mouseX / 20.
espaco = 1 + mouseY / 20. # o 1 é pra não ter divisão por zero
linhas = int(height / espaco)
colunas = int(width / espaco)
for j in range(linhas):
y = espaco / 2 + j * espaco
for i in range(colunas):
x = espaco / 2 + i * espaco
ang = radians(x / 2. + y / 2. + frameCount)
matiz = 128 + 128 * sin(ang)
cor = color(matiz, 255, 255)
fill(cor)
ellipse(x, y, tam, tam)
@villares
Copy link
Author

Captura de tela_2020-03-18_16-23-17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment