Postagens

Atividade 11 - Aula 14

Imagem
Exemplo: Código: let pdf; function setup() { createCanvas(640, 480); background(0); pdf = createPDF(); pdf.beginRecord(); } function draw() { noStroke(); fill(255); ellipse(mouseX, mouseY, 20, 20); } function mousePressed(){   if (mouseButton === LEFT) {     saveCanvas('imagem'+frameCount+'.png');   } else if (mouseButton === RIGHT) {     pdf.save();   } else if (mouseButton === CENTER) {     pdf.nextPage();   } }

Atividade 9 - Aula 12

Imagem
Exemplo: Código: let modulo = 0; function setup() {   createCanvas(500, 500);   modulo = width * 4.5; } function draw() {   // put drawing code here   background(0);   circleInception(mouseX, mouseY, modulo+=50);   if(modulo > width*3) modulo = width; } function circleInception(x, y, size) {   stroke(255);   fill(color(0,0,0,0));   ellipse(x, y, size, size);   if(size <= width/100) {     return;   } else {     circleInception(x, y, size/3.0);   } }

Atividade 7 - Aula 10

Imagem
Exemplo: Código: function setup() {   let p = [new Brasileiro("Yarick Ivens", 26, "Ilustrador"), new Ingles("Yarick Ivens", 26, "Ilustrador"), new Frances("Yarick Ivens", 26, "Ilustrador")];   for(let i = 0; i < p.length; i++) {     p[i].dizerNome();     p[i].dizerIdade();     p[i].dizerProfissao();   } } function draw() {   // put drawing code here } class Pessoa {   constructor(nome, idade, profissao) {     this.nome = nome;     this.idade = idade;     this.profissao = profissao;   }   dizerNome() {}     dizerIdade() {}   dizerProfissao() {} } class Brasileiro extends Pessoa {   constructor(nome, idade, profissao) {     super(nome, idade, profissao);   }   dizerNome() {     print("Meu nome é " + this.nome);   }     dizerIdade() {     print("Minha idade é " + this.idade);   }   dizerProfissao() {     print("Minha profissão é " + this.profissao);

Atividade 6 - Aula 9

Imagem
Exemplo: Código: let form1; let form2; let form3; function setup() {   createCanvas(600, 400); form1 = new Forma(random(20, 50), random(0, 100) < 50); form2 = new Forma(random(20, 50), random(0, 100) < 50); form3 = new Forma(random(20, 50), random(0, 100) < 50); } function draw() {     background(0); form1.mover(); form1.colidir(); form1.exibir(); form2.mover(); form2.colidir(); form2.exibir(); form3.mover(); form3.colidir(); form3.exibir(); } class Forma{ constructor(tamanho, quadrado = false){ this.tamanho = tamanho; this.x = random(this.tamanho/2, width - this.tamanho/2); this.y = random(this.tamanho/2, height - this.tamanho/2); this.pX = random(2, 4); this.pY = random(2, 4);     this.cor = color(0, 150, 180);     this.quadrado = quadrado; } mover(){ this.x += this.pX; this.y += this.pY; } mudaCor(){ this.cor = color(180, 0, 150); } colidir(){ if(this.x >= width - this.taman

Atividade 5 - Aula 8

Imagem
Exemplo: Código: function setup() {   var p = new Pessoa("Yarick Ivens", 26, "Ilustrador");   p.dizerNome();   p.dizerIdade();   p.dizerProfissao(); } function draw() {   // put drawing code here } class Pessoa {   constructor(nome, idade, profissao) {     this.nome = nome;     this.idade = idade;     this.profissao = profissao;   }   dizerNome() {     print("Meu nome é " + this.nome);   }     dizerIdade() {     print("Minha idade é " + this.idade);   }   dizerProfissao() {     print("Minha profissão é " + this.profissao);   } }

Atividade 4 - Aula 6

Imagem
Exemplo: Código: var timer; var x = []; var y = []; function setup() {   createCanvas(500, 500);   randomizeXY();   timer = millis(); } function draw() {   // put drawing code here   background(230);   line(0, height/2, width, height/2);   line(width/2, 0, width/2, height);     for(let i = 0; i <= 10; i++) {     if(y[i] < height/2) {       if(x[i] > width/2) {         superiorEsquerdo(x[i], y[i]);       } else {         superiorDireito(x[i], y[i]);       }     } else {       if(x[i] > width/2) {         inferiorEsquerdo(x[i], y[i]);       } else {         inferiorDireito(x[i], y[i]);       }     }   }   if(millis() - timer >= 5000){     randomizeXY(); timer = millis(); } } function randomizeXY() {   for(let i = 0; i <= 10; i++) {     x[i] = random(0, width+1);     y[i] = random(0, height+1);   } } function superiorEsquerdo(x, y) {   fill(255);   ellipse(x, y, 10, 10); } function superiorDireito(x, y) {   fil

Atividade 3 - Aula 5

Imagem
Código: Resultado: