03.10.2014
/*
Processing 2.2.1
----------------
Practica 2B
David Sepulveda
 
*/
 
//var barco 
  float x, y;
  float dim = 80.0;
 
  //var gaviotas
  int mov = -20;
  int vmov = 3;
  
 
void setup (){
  size (600,600);
  frameRate (12);  
}
  
 
void draw (){    
  //fondo
  float varC = (mouseX * 0.57890);
  background (0,0,varC);
 
  //sol  
  float u = map(mouseX, 0, width, 255, 0);
  fill(255,255,u);
  noStroke();
  ellipse(mouseX, 100 , 150-varC, 150-varC);
 
 
  //fill(20,56,56);
    
  //gaviotas
   mov += vmov;
  if(mov <= -20 || mov >= 20 ){
    vmov *= -1;   
    mov += vmov;
  } 
 
  stroke(255, 255, 255);
  noFill();
  curve(400, 180, 430, 100, 400, 100+mov, 430, 180);
  curve(430, 180, 460, 100+mov, 430, 100, 460, 180);
 
  curve(430, 210, 460, 130, 430, 130+mov, 460, 210);
  curve(460, 210, 490, 130+mov, 460, 130, 490, 210);
  noStroke();
    
  //mar  
  for(int i = 1; i<width; i+=7){  
  fill(0,0,random(0,255));
  triangle(i,random(height/2, height),random(0,height),random(height/2, height),random(0,height),random(height/2, height));    
  }
  
  //barco
  x = x + 0.7;
  if (x > width + dim) x = -dim;
  translate(x, height/2-dim/2);
  fill(255);
  beginShape();
    vertex(57.5, 50);
    vertex(57.5, 1); 
    vertex(92, 50); 
    vertex(57.5, 70); 
    vertex(22, 50);
  endShape();
  
}
 
void mouseReleased() {  
  if (key== 's' || key == 'S') {
    saveFrame("screenshot.png");
  }
}
/*
Processing 2.2.1
----------------
Practica 2B
David Sepulveda

*/

//var barco 
  float x, y;
  float dim = 80.0;

  //var gaviotas
  int mov = -20;
  int vmov = 3;
  

void setup (){
  size (600,600);
  frameRate (12);  
}
  

void draw (){    
  //fondo
  float varC = (mouseX * 0.57890);
  background (0,0,varC);

  //sol  
  float u = map(mouseX, 0, width, 255, 0);
  fill(255,255,u);
  noStroke();
  ellipse(mouseX, 100 , 150-varC, 150-varC);
 
 
  //fill(20,56,56);
    
  //gaviotas
   mov += vmov;
  if(mov <= -20 || mov >= 20 ){
    vmov *= -1;   
    mov += vmov;
  } 
 
  stroke(255, 255, 255);
  noFill();
  curve(400, 180, 430, 100, 400, 100+mov, 430, 180);
  curve(430, 180, 460, 100+mov, 430, 100, 460, 180);

  curve(430, 210, 460, 130, 430, 130+mov, 460, 210);
  curve(460, 210, 490, 130+mov, 460, 130, 490, 210);
  noStroke();
    
  //mar  
  for(int i = 1; i<width; i+=7){  
  fill(0,0,random(0,255));
  triangle(i,random(height/2, height),random(0,height),random(height/2, height),random(0,height),random(height/2, height));    
  }
  
  //barco
  x = x + 0.7;
  if (x > width + dim) x = -dim;
  translate(x, height/2-dim/2);
  fill(255);
  beginShape();
    vertex(57.5, 50);
    vertex(57.5, 1); 
    vertex(92, 50); 
    vertex(57.5, 70); 
    vertex(22, 50);
  endShape();
  
}

void mouseReleased() {  
  if (key== 's' || key == 'S') {
    saveFrame("screenshot.png");
  }
}
Grado en Bellas Artes - Facultad de Bellas Artes - Universidad Politécnica de Valencia