noise() values in Processing vs ProcessingJS
              in 
             Processing with Other Languages 
              •  
              8 months ago    
            
 
           
             Hello all...
            
             
            
            
             
             
           
 
            
           
             I've noticed something odd. I have a sketch which uses noise() that I then map to the width and height of the display window. On Java Mode this works fine, and the co-ordinates move around the whole display.
            
            
             However, when I switch to JavaScript mode, the values seem to constrain themselves to near the centre of the screen (or near the starting point) They don't drift near as much as in the Java mode.
            
            
             Any ideas why this is happening?
            
            - float x,y,x2,y2,px,py;
- float nx,ny;
- color c;
- void setup(){
- size(800,600);
- colorMode(HSB);
- background(0);
- c = 255;
- stroke(c,20);
- nx = 0;
- ny = 20000;
- x = map(noise(nx),0,1,0,width);
- y = map(noise(ny),0,1,0,height);
- px = x;
- py = y;
- }
- void draw(){
- x = map(noise(nx),0,1,0,width);
- y = map(noise(ny),0,1,0,height);
- for(int i = 0;i<int(random(25,50));i++){
- float d = random(360);
- float r = radians(d);
- float x2 = x + sin(r) * random(50);
- float y2 = y + cos(r) * random(50);
- stroke(c,20);
- line(x,y,x2,y2);
- }
- stroke(c,200);
- line(x,y,px,py);
- nx+=0.01;
- ny+=0.01;
- px = x;
- py = y;
- }
 
              
              1  
            
 
            
 
 
           
 
             
 
            