Baixe o app para aproveitar ainda mais
Prévia do material em texto
2015 | --- | --- | --- | A1 | Folha 01 Docente: Aluno: Data: 09/04/2015 Nota: Trabalho(s): 1) Qual dos programas abaixo gera a seguinte imagem A) ( X ) B) ( X ) C) ( ) void setup() { size(200,200); } void draw() { fill(0); noStroke(); rect(10,10,180,180); fill(100); rect(40,40,120,120); stroke(255); line(10,10,190,190); ellipse(100,100,30,30); } void setup() { size(200,200); } void draw() { fill(0); noStroke(); ellipse(100,100,150,150); fill(100); rect(50,50,100,100); stroke(255); line(50,50,150,150); line(100,100,150,50); } void setup() { size(200,200); } void draw() { fill(0); noStroke(); rect(10,10,180,180); fill(100); ellipse(100,100,150,150); stroke(255); line(10,10,190,190); line(100,100,150,50); } 2) Marque as linhas que contém erros no código abaixo: Erro Código x 1 float z = 0 e x = 1; 2 void setup() { 3 size(300,200); 4 } 5 void draw() ( x 6 fill{0}; x 7 rect(0,0,300,300) 8 if (x < 100) { 9 z = z + (pow(x,2)+ 2*x); 10 x - x + 1; x 11 ( x 12 fill(255,0); 13 textSize(32); 14 text(z,70,150); 15 } 3) O programa desenha uma diagonal de círculos (diâmetro 10 px) da base até o topo da janela (imagem A) usando um procedimento que possui os argumentos x, y e t. Altere o bloco draw() para que, usando o procedimento, gere a imagem B. Caso necessário redefina os valores iniciais de x, y e tam. A. B. int x = 100, y = 100, tam = 20; void setup() { size(200,200); noStroke(); fill(0); rect(0,0,width,height); fill(255); } void draw() { dCirculos(x,y,tam); } void dCirculos(int x, int y, int t) { ellipse(x+t,y,10,10); ellipse(x,y+t,10,10); ellipse(x-t,y,10,10); ellipse(x,y-t,10,10); } Responda aqui: int tam = 0 ; int x=100,y=100; void draw() { dCirculos(x,y,tam); tam = tam + 10; } 2015 | --- | --- | --- | A1 | Folha 02 Docente: Aluno: Data: 09/04/2015 Nota: Trabalho: 4) O código abaixo gera a imagem A, complete as linhas em branco para gerar a imagem B: A. B. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 float x = 100, y = 100, tam = 60; void setup() { size(200,200); fill(255); rect(0,0,width,height); noFill(); stroke(0); } void draw() { ellipse(x,y,tam,tam); rect(x-tam/2, y-tam/2,tam,tam); x = x – 10; tam = tam*sqrt(2); } 5) Faça um programa que calcule o valor h. Use o como base setup() e draw(). Uma vez calculado h mostre o valor como um texto na tela (text(), tamanho 30, cor preta). Responda abaixo: (caso necessário use o verso, numere as linhas) 1 float h = 0, s = 27; 2 void setup() { 3 size(400, 200); 4 } 5 6 void draw() { 7 if (s <= 500) { 8 fill(255); 9 rect(0,0,400,200); 10 h = h + pow(s,2) + 2*s - sqrt(s); 11 s = s + 1; 12 fill(0); 13 textSize(30); 14 text(h,0,30); 15 } 16 } 17 18 19 20 s s
Compartilhar