Anonymous Anonymous - 12 days ago
276 0

No description

Java

Rotating panels

float rot =0;
float speed = 0;
float size = 0;


void setup(){
  size(400,400); // define display window size
  background(100,50,50);// define background color
  smooth();//
  noStroke();
  noFill();
  colorMode(HSB, 255);
}


void draw_rotating_rectangle(float x,float y,float rect_size,float r){
 
  translate(x,y);//move the center of rotation
  rotate(r);
  rect(0,0,rect_size,rect_size);
  resetMatrix();
}

void draw(){
  background(100,50,50);// changes background color 
  
  
  float x=0;
  while (x<8){
    float y =0;
    while (y<8){
     draw_rotating_rectangle( 60+x*40,60+y*30,4+size,rot + x +speed);//
      y=y+1;
      
       speed =map(mouseX, 0,width,1,30); //mouseX is mapped to the the strokeweight of the mouse from range 1-10
      //strokeWeight(sweight); 
      size = map(mouseY, 0, height,0, 19);
      float colorhue =map(mouseY,0,height,0,120); //mouseY changes the hue color range of the mouse
      stroke(colorhue,150,255);// stroke with hue color range 150-255
   
     
    }
    x=x+1;
  }
  rot=rot+0.05;
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download