• fullscreen
  • Bouncy_Thing.pde
  • Prism.pde
  • class BounceBox {
      
     float radius = 3;
     float bsize = 3;//b size means box size
     float zrot = 90;
     float yrot = 5;
     
     BounceBox() {
       
       
     };
     
     void update() {
       zrot += bsize/2;
       
     }
     void draw() {
       //Draw the box
       pushMatrix();
        rotateZ(zrot);
        rotateY(yrot);
        translate(radius,9);
        box(bsize);
       popMatrix();
     };
     
    };
      
    
    
    import processing.opengl.*;
    
    /*Prism
    veronyu@hotmail.com
    September, 2009
    
    */
    
    int boxNum = 10000;//change the number of boxes shown on screen
    BounceBox[] boxes = new BounceBox[boxNum];
    
    int saveCount = 0;
    
    void setup() {
      size(1000,1000,OPENGL);
      background(0);
    
      
      //Make the BounceBoxes
      for (int i = 0; i< boxNum; i++){
        BounceBox newbie = new BounceBox();
        boxes[i] = newbie;
        newbie.radius = i * Y;
        newbie.zrot = i * 0.123;
        newbie.yrot = i * 0.123;
        newbie.bsize = random(1000,1000);
      };
    };
    
    void draw() {
      background(45);
      lights();
      stroke(45);
     
      translate(width/100, height/100);
      
     
      rotateZ((float)mouseX/width*(PI * 1));
      rotateY((float)mouseY/width*(PI * 0.2));
      
      for(int i = 0; i < boxNum; i++) {
        boxes[i].update();
        boxes[i].draw();
     
     };
      };
      
    void mousePressed() {
      save("myImage" + saveCount + ".png");
      saveCount ++;
    };
    
    
    
    
    

    code

    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.

    license

    advertisement

    Veronica

    Prism

    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    You need to login/register to comment.