Voltar à página Processing

Atividade - Cartão de Boas Festas

Boas Festas

Um dos primeiros trabalhos com o Processing. void flocos () permite o desenho dos flocos de neve, de uma forma aleatória.

/* Carlos Raminhos
atividade 3
PAD, MEGA
30-novembro-2011
*/
int posx= 210;
int posy= 220;
PFont fontA;

void setup() {
  noLoop();
  smooth();
  size (600,450);
  fontA = loadFont("Ziggurat-48.vlw");
  textFont(fontA);
}

void draw () {
  fundo (56, 170, 226);
  corpo();
  cabeca();
  flocos();
  chapeu();
  fill(255);
  text("B o a s  F e s t a s", 50, 90);
  }

void fundo (int r, int g, int b) {
 fill(255);
 noStroke();
    for (int j = 0; j <450; j++) {   
    stroke(r+(j*0.3), g+(j*0.1), b);
    line(0, j, 600, j);
  } 
   //chao branco
 noFill();
strokeWeight(10);
stroke(245);
beginShape();
vertex(0, 350); // ponto inicial
bezierVertex(0, 350, 100, 380, 200, 350); 
bezierVertex(200, 350, 300, 300, 500, 350);
bezierVertex(500, 350, 570, 380, 600, 370);
endShape();
beginShape();
fill(245);
vertex(0,360);
vertex(80,370);
vertex(180,360);
vertex(280,335);
vertex(380, 335);
vertex(480, 350);
vertex(580,375);
vertex(600,370);
vertex(600,450);
vertex(0,450);
vertex(0, 360);
endShape();

   //enquadramento
   rect(0,0,width,20);
   rect(0,430,width,20);
   rect(0,20,20,height);
   rect(580,0,20,height);
   stroke(228, 6, 19);
   strokeWeight(3);
   line(20,20,580,20);
   line(20,20,20,430);
   line(20,430,580,430);
   line(580,430,580,20);
}

 void corpo (){
    noStroke();
    fill(180);
    ellipse(posx, posy+177, 160, 20);//sombra maior
    fill(134);
    ellipse(posx, posy+177, 80, 10); //sombra menor 
    fill(255);
    ellipse(posx, posy+97, 160, 160); //corpo
    fill(245,20,39);                  //botoes
    stroke(0);
    strokeWeight(1);
    ellipse(posx, posy+100, 15,15);
    fill(212,216,15);
     ellipse(posx, posy+70, 15,15);
     fill(59, 63, 234);
      ellipse(posx, posy+130, 15,15);//botoes fim
    stroke(94, 75, 61);
    strokeWeight(7);
    line(posx-60, posy+77, posx-140, posy+7);//troncos
    line(posx+60, posy+77, posx+140, posy+7);
    strokeWeight(4);                          //troncos mais pequenos
    line(posx-123, posy+17, posx-120, posy-3);
    line(posx+123, posy+17, posx+120, posy-3);
    line(posx-110, posy+35, posx-180, posy+10);
    line(posx+85, posy+55, posx+145, posy+45);
    line(posx-80, posy+55, posx-90, posy+5);    //troncos mais pequenos fim
 }
 
 void cabeca () {
   noStroke();
   fill(228);
  ellipse(posx, posy+5, 80, 80);//cabeca
  fill(255);
  ellipse(posx, posy, 80, 80);//sombra pescoco
  fill(0);
  ellipse(posx-20, posy+14, 12, 12);//olhos
  ellipse(posx+20, posy+14, 12, 12);//olhos
  fill(245,146,1);
  triangle(posx, posy+55, posx-10,posy+20, posx+10, posy+20); //nariz
}

void chapeu () {
  noStroke();
  fill(0);
  rect(posx-40, posy-53, 80, 40);
  fill(228, 6, 19);
  rect(posx-40, posy-13, 80, 10);//fita vermelha
  fill(0);
  rect(posx-50, posy-3, 80+20, 5);
  fill(228, 228, 228);
  rect(posx-40, posy+2, 80, 4); 
}

void flocos () {
  noStroke();
   fill(255); 
 for (int nevex = 23; nevex < width; nevex+=30) {
   int raio= int (random (5, 10));
 for (int nevey= 23; nevey<300; nevey+=30) {
   nevex = int (random ( 24, 577));
    nevey = int (random (24, 427));
  ellipse(nevex, nevey, raio, raio);
   }  
  }  
}

Realizado por Carlos Raminhos

postal_Natal_2.pde

Built with Processing.org