  | 
    
 
  
    
    
      
        
          
         Author | 
        
         Topic: 1nformation: Dis0rganized  (Read 2589 times) | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            Martin 
      
                  
      
             | 
            
            
            
              
                
                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);    }   |  
  |    
            
             | 
           
            | 
            
            
            
             | 
           
         
         | 
       
     
     | 
   
 
 
 |