1. Processing - Funções Repetição (Função FOR, Operadores, Rotação e Translação)
2. Exercício para a aula de 26/09/2018
- Os alunos devem executar uma Mandala utilizando a função FOR. Utilizar variáveis ou;
- Os alunos devem executar um Tabuleiro utilizando a função FOR com variação de cores conforme o exemplo da imagem abaixo. Não precisa ser círculos (podem ser quadrados, triângulos, etc...)
Exemplo de Mandala
Código da Mandala
//Mandala
size(500,500);
background(#26B4A2);
translate(height/2, width/2);
smooth();
for (int i=0; i<50; i++){
fill(#0A4D45);
triangle(0,0,40,40,50,20);
fill(#110A4D, 80);
rect(0,0,100,150);
fill(#460A4D, 80);
triangle(0,0,200,30,300,30);
line(0,0,200,250);
fill(#AD0A87,20);
ellipse(100,100,200,300);
rotate(PI/10);
}
Exemplo de Tabuleiro
Código do Tabuleiro sem função For
//Exercício For
// Transformar o código utilizando a função FOR.
size(500,500);
background(0);
smooth(2);
fill(255,0,0);
ellipse(25,25,30,30);
ellipse(75,25,30,30);
ellipse(125,25,30,30);
ellipse(175,25,30,30);
ellipse(225,25,30,30);
ellipse(275,25,30,30);
ellipse(325,25,30,30);
ellipse(375,25,30,30);
ellipse(425,25,30,30);
ellipse(475,25,30,30);
fill(255,25,0);
ellipse(25,75,30,30);
ellipse(75,75,30,30);
ellipse(125,75,30,30);
ellipse(175,75,30,30);
ellipse(225,75,30,30);
ellipse(275,75,30,30);
ellipse(325,75,30,30);
ellipse(375,75,30,30);
ellipse(425,75,30,30);
ellipse(475,75,30,30);
fill(252,50,0);
ellipse(25,125,30,30);
ellipse(75,125,30,30);
ellipse(125,125,30,30);
ellipse(175,125,30,30);
ellipse(225,125,30,30);
ellipse(275,125,30,30);
ellipse(325,125,30,30);
ellipse(375,125,30,30);
ellipse(425,125,30,30);
ellipse(475,125,30,30);
fill(252,75,0);
ellipse(25,175,30,30);
ellipse(75,175,30,30);
ellipse(125,175,30,30);
ellipse(175,175,30,30);
ellipse(225,175,30,30);
ellipse(275,175,30,30);
ellipse(325,175,30,30);
ellipse(375,175,30,30);
ellipse(425,175,30,30);
ellipse(475,175,30,30);
fill(252,100,0);
ellipse(25,225,30,30);
ellipse(75,225,30,30);
ellipse(125,225,30,30);
ellipse(175,225,30,30);
ellipse(225,225,30,30);
ellipse(275,225,30,30);
ellipse(325,225,30,30);
ellipse(375,225,30,30);
ellipse(425,225,30,30);
ellipse(475,225,30,30);
fill(252,125,0);
ellipse(25,275,30,30);
ellipse(75,275,30,30);
ellipse(125,275,30,30);
ellipse(175,275,30,30);
ellipse(225,275,30,30);
ellipse(275,275,30,30);
ellipse(325,275,30,30);
ellipse(375,275,30,30);
ellipse(425,275,30,30);
ellipse(475,275,30,30);
fill(252,150,0);
ellipse(25,325,30,30);
ellipse(75,325,30,30);
ellipse(125,325,30,30);
ellipse(175,325,30,30);
ellipse(225,325,30,30);
ellipse(275,325,30,30);
ellipse(325,325,30,30);
ellipse(375,325,30,30);
ellipse(425,325,30,30);
ellipse(475,325,30,30);
fill(252,175,0);
ellipse(25,375,30,30);
ellipse(75,375,30,30);
ellipse(125,375,30,30);
ellipse(175,375,30,30);
ellipse(225,375,30,30);
ellipse(275,375,30,30);
ellipse(325,375,30,30);
ellipse(375,375,30,30);
ellipse(425,375,30,30);
ellipse(475,375,30,30);
fill(252,425,0);
ellipse(25,425,30,30);
ellipse(75,425,30,30);
ellipse(125,425,30,30);
ellipse(175,425,30,30);
ellipse(225,425,30,30);
ellipse(275,425,30,30);
ellipse(325,425,30,30);
ellipse(375,425,30,30);
ellipse(425,425,30,30);
ellipse(475,425,30,30);
fill(252,475,0);
ellipse(25,475,30,30);
ellipse(75,475,30,30);
ellipse(125,475,30,30);
ellipse(175,475,30,30);
ellipse(225,475,30,30);
ellipse(275,475,30,30);
ellipse(325,475,30,30);
ellipse(375,475,30,30);
ellipse(425,475,30,30);
ellipse(475,475,30,30);
|
|