FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Information Visualization
(Moderators: forkinsocket, REAS)
   1nformation: Dis0rganized
« Previous topic | Next topic »

Pages: 1 2 
   Author  Topic: 1nformation: Dis0rganized  (Read 2589 times)
Martin

122417302122417302martingomez_listsmg1ph WWW Email
Re: 1nformation: Dis0rganized
« Reply #15 on: Mar 11th, 2003, 4:57am »

on Mar 9th, 2003, 11:38pm, benelek wrote:
if u want the rotation to vary with mouse movement, u can have a rotateX/Y/Z(rotaterVar) at the begining of the loop(), and then in mouseDragged() put rotaterVar+=(mouseX-pmouseX);

 
this works:
 
Code:
void setup() {  
  //stuff.  
  size(200,200);
  background(50);
  noStroke();
  fill(255);
  smooth();
  lights();
}  
 
float rotaterVar=0;  
float a = 0;
 
void loop() {  
  translate(100,100);
  rotateY(rotaterVar);  
  rotateX(a);
  box(50);
  a += 0.01;
}  
 
void mouseDragged() {  
  rotaterVar+=0.5*radians(mouseX-pmouseX);  
}

 
this, however, gives some funny stuff:
 
Code:

void setup() {  
  //stuff.  
  size(200,200);
 // background(50);
  noStroke();
  fill(255);
  smooth();
  lights();
}  
 
float rotaterVar=0;  
float a = 0;
int b = 0;
 
void loop() {  
  translate(100,100);
  rotateY(rotaterVar);  
  rotateX(a);
  for(int i = 0; i < 10; i++ ) {
    b = int(random(10,30));
    box(b);
  }
  a += 0.01;
}  
 
void mouseDragged() {  
  rotaterVar+=0.5*radians(mouseX-pmouseX);  
}
 
Pages: 1 2 

« Previous topic | Next topic »