header box hoek3d
 
animatie met boxen en 3d hoeken                                          terug naar de inleiding
 
de schets maakt gebruik van de superclass "Vormen" en de subclasses "Hoek3d_na4n", "Hoek3d_na2n", en "Box_2na"
 
Bekijk de heen en weer en op en neer bewegende boxen
 
 

Vormen [] vorm; 
void setup()  {   
 // fullScreen(); 
  size(560,560);   
  float x = width/2; 
  float y = height/2; 
  float n   = height/15;  
  vorm = new Vormen[16]; 
  vorm[0] = new Hoek3d_na4n(n, 4, x-5*n, y-5*n, -45,  
  color(#FF0000,100),color(#32FF0A,100),color(#57F539,50),color(#05FC06,50), color(#05FC06,50));   
   
  vorm[1] = new Hoek3d_na2n(n, 4, x-3*n, y-3*n, -45,  
  color(10,10,10,0),color(10,10,10,0),color(10,10,10,0),color(10,10,10,0), color(10,10,10,0)); 
   
  vorm[2] = new Hoek3d_na4n(n, 4, x+5*n, y-5*n , 45,  
  color(#FF0000, 100),color(#32FF0A, 100),color(#57F539,50),color(#05FC06,50),color(#05FC06,50)); 
   
  vorm[3] = new Hoek3d_na2n(n, 4, x+3*n, y-3*n , 45,  
  color(10,10,10,0),color(10,10,10,0),color(10,10,10,0),color(10,10,10,0),color(10,10,10,0)); 
   
  vorm[4] = new Hoek3d_na4n(n, 4, x+5*n, y+5*n, 135,  
  color(#FF0000,100),color(#32FF0A, 100),color(#57F539,50),color(#05FC06,50),color(#05FC06,50)); 
   
  vorm[5] = new Hoek3d_na2n(n, 4, x+3*n, y+3*n, 135,  
  color(10,10,10,0),color(10,10,10,0),color(10,10,10,0),color(10,10,10,0),color(10,10,10,0)); 
     
  vorm[6] = new Hoek3d_na4n(n, 4, x-5*n, y+5*n, -135,  
  color(#FF0000,100),color(#32FF0A,100),color(#57F539,50),color(#05FC06, 50),color(#05FC06, 50)); 
   
  vorm[7] = new Hoek3d_na2n(n, 4, x-3*n, y+3*n, -135,  
  color(10,10,10,0),color(10,10,10,0),color(10,10,10,0),color(10,10,10,0),color(10,10,10,0)); 
   
  vorm[8] = new Box_2na(n, 1, x, y, 90,   color(#3BF716,150), color(#228110,100), color(#64E34C,100)); 
  vorm[9] = new Box_2na(n, 1, x, y, 180,  color(#3BF716,150), color(#228110,100), color(#64E34C,100)); 
  vorm[10] = new Box_2na(n, 1, x, y, 270, color(#3BF716,150), color(#228110,100), color(#64E34C,100)); 
  vorm[11] = new Box_2na(n, 1, x, y, 0,   color(#3BF716,150), color(#228110,100), color(#64E34C,100)); 
  vorm[12] = new Box_2na(n, 1, x, y, 90,  color(#3BF716,150), color(#228110,100), color(#64E34C,100)); 
  vorm[13] = new Box_2na(n, 1, x, y, 180, color(#3BF716,150), color(#228110,100), color(#64E34C,100)); 
  vorm[14] = new Box_2na(n, 1, x, y, 270, color(#3BF716,150), color(#228110,100), color(#64E34C,100)); 
  vorm[15] = new Box_2na(n, 1, x, y, 0,   color(#3BF716,150), color(#228110,100), color(#64E34C,100)); 
} 
 
void draw()  { 
 background(#E6FBFF); 
  
  for (int i = 0; i < 16; i++) 
  { 
    vorm[i].display(); 
  } 
    
  vorm[8].opEnNeer();    
  vorm[9].opEnNeer(); 
  vorm[10].neerEnOp(); 
  vorm[11].neerEnOp();    
  vorm[13].heenEnWeer(); 
  vorm[14].heenEnWeer();   
  vorm[15].weerEnHeen(); 
  vorm[12].weerEnHeen(); 
} 
 
void keyPressed() {     
  if (key == 's') {    
    noLoop();  
  }     
  if (key == 'r') {       
    loop();  
  }  
}