> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.bNCT2yp-YLH/rev.562
 * 
 * authors: 
 *   Graham Jans

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



// Pressing Control-R will render this sketch.

int i = 0; 

void setup()
{
    size(500, 500, OPENGL); 
} 

float ix = 0;
float iy = 0;
float iz = 0;
    

void draw()
{
    background(200, 225, 250);
    
    float dist = width;
    
    camera(sin(millis()/1000)*dist, 0, cos(millis()/1000)*dist,
           0, 0, 0,
           0, 1, 0);
            
     perspective(45, 1, dist-100, dist+100);
    
    lights();
    
    noStroke();
    fill(200, 225, 250, 100);
    
    
    float x = ix;
    float y = iy;
    float z = iz;
    
    for ( int i = 0; i < 50; i++ )
    {
        
        translate(noise(x, y, z+1)*20-10, noise(x, y, z+2)*20-10, noise(x, y, z+3)*20-10);
        rotateX(noise(x, y+1, z)*(PI/6)-HALF_PI/6);
        rotateY(noise(x, y+2, z)*(PI/6)-HALF_PI/6);
        rotateZ(noise(x, y+3, z)*(PI/6)-HALF_PI/6);
        scale(1+noise(x+1, y, z)*0.2-0.1, 1+noise(x+2, y, z)*0.2-0.1, 1+noise(x+3, y, z)*0.2-0.1);
        
        box(100, 100, 100);
        
        x += 0.01*random();
        y += 0.01*random();
        z += 0.01*random();
    }
    
    

    ix += 0.01;
    iy += 0.01;
    iz += 0.01;
}