This file contains hidden or 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
var lista_de_bolas = []; // variável global para guardar bolas | |
function setup() { | |
createCanvas(800,600); | |
} | |
function draw() { | |
background(0) | |
for (var i = 0; i < lista_de_bolas.length; i++) { // itera pela lista de bolas | |
lista_de_bolas[i].desenha(); |
This file contains hidden or 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
def setup(): | |
""" This code is called once by Processing """ | |
global x, y | |
size(100, 100) # Canvas size | |
x, y = width / 2, height / 2 # Middle of the canvas | |
def draw(): | |
""" The 'main loop' invoked by Processing """ | |
global x, y | |
background(0) # Cleans the canvas, with black |
This file contains hidden or 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
def setup(): | |
""" Code called once by Processing """ | |
size(100, 100) | |
bandeirinha(50, 50) | |
def bandeirinha(px, py, flag_size=50): | |
""" Draws a small flag at px, py, default size 50px """ | |
half_flag = flag_size / 2 | |
with pushMatrix(): # preserve the original coordinate system | |
translate(px, py) # change the origin |
This file contains hidden or 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
def setup(): | |
""" Código de configuração, executado no início pelo Processing """ | |
global x, y | |
size(100, 100) # área de desenho | |
# bandeirinha(50, 50) # chama a função bandeirinha no Passo 0, linhs removida no Passo 1 | |
x, y = width / 2, height / 2 # coordenadas do meio da área de desenho | |
def draw(): # Acréscimo do Passo 1 | |
""" Laço principal de repetição do Processing """ | |
global x, y |
This file contains hidden or 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
""" | |
Exemplo de uso da Classe Bandeirinhas, com mudança de cor 'mouse over' | |
clique para acrescentar um objeto, tecle 'espaço' para remover | |
""" | |
bandeirinhas = [] # lista de objetos | |
def setup(): | |
""" Define área de desenho e popula lista de bandeirinhas """ | |
global bandeira_0 |
This file contains hidden or 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
""" | |
Exemplo de uso da Classe Bandeirinhas, com mudança de cor 'mouse over' | |
clique para acrescentar um objeto, tecle 'espaço' para remover | |
""" | |
bandeirinhas = [] # lista de objetos | |
def setup(): | |
""" Define área de desenho e popula lista de bandeirinhas """ | |
size(400, 400) # área de desenho |
This file contains hidden or 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
/* Exemplo de uso da classe Bandeirinhas, com mudança de cor 'mouse over' | |
* clique para acrescentar um objeto, tecle 'espaço' para remover. | |
*/ | |
ArrayList<Bandeirinha> bandeirinhas; // lista de objetos | |
void setup() { | |
/* define área de desenho e popula lista de bandeirinhas */ | |
size(400, 400); // área de desenho | |
float meia_largura = width / 2; |
This file contains hidden or 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
""" | |
A Processing implementation of Game of Life By Joan Soler-Adillon | |
Press SPACE BAR to pause and change the cell's values with the mouse | |
On pause, click to activate/deactivate cells | |
Press R to randomly reset the cells' grid | |
Press C to clear the cells' grid | |
The original Game of Life was created by John Conway in 1970. | |
""" |
This file contains hidden or 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
import urllib.request | |
import json | |
url = 'http://educacao.dadosabertosbr.com/api/escolas/buscaavancada?situacaoFuncionamento=1&energiaInexistente=on&aguaInexistente=on&esgotoInexistente=on' | |
resp = urllib.request.urlopen(url).read() | |
resp = json.loads(resp.decode('utf-8')) | |
print ('Número de Escolas em funcionamento sem energia, água e esgoto:', resp[0]) | |
for x in resp[1]: | |
print (x['nome'], x['cod']) | |
print (x['cidade'], x['estado'], x['regiao']) | |
print () |
This file contains hidden or 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
import urllib.request | |
import json | |
url = 'http://educacao.dadosabertosbr.com/api/escolas/buscaavancada?situacaoFuncionamento=1&energiaInexistente=on&aguaInexistente=on&esgotoInexistente=on' | |
resp = urllib.request.urlopen(url).read() | |
resp = json.loads(resp.decode('utf-8')) | |
print ('Número de Escolas em funcionamento sem energia, água e esgoto:', resp[0]) | |
for x in resp[1]: | |
print (x['nome'], x['cod']) | |
print (x['cidade'], x['estado'], x['regiao']) | |
print () |
OlderNewer