-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
Processing-Python-py5/estudos-para-exemplos/particulas0.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from py5_tools import animated_gif | ||
|
||
tamanho = 50 | ||
|
||
def setup(): | ||
"""Código de configuração, executado no início pelo py5.""" | ||
global x, y # a instrução global permite atribuir nomes a variáveis globais nesta função | ||
size(100, 100) # área de desenho | ||
x, y = width / 2, height / 2 # coordenadas do meio da área de desenho | ||
animated_gif('particulas0.gif', count=22, period=0.10, duration=0.10) | ||
|
||
|
||
def draw(): | ||
"""O laço principal de repetição do Processing usado para animações e sketches interativos.""" | ||
global x, y | ||
background(0) # limpeza do frame, fundo preto | ||
circle(x, y, tamanho) # desenha um círculo | ||
x += 1 # incrementa o x (equivale a x = x + 1) | ||
y += 1 # incrementa o y | ||
if x > width + tamanho / 2: | ||
x = -tamanho / 2 | ||
if y > height + tamanho / 2: | ||
y = -tamanho / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters