• fullscreen
  • ps3_4.pde
  • shape.pde
  • // SIMONE ROTH - PS 3 # 4 // 
    
    Square[] square = new Square[50];
    
    void setup() {
      size(500, 500);
      smooth();
      background(240);
      noStroke();
      for (int i=0; i < square.length; i++) {
        square[i] = new Square(width/2, height/2, 40, 40);
      }
    }
    
    void draw() {
      for (int i=0; i < square.length; i++) {
        square[i].display();
      }
    }
    
    
    
    // SIMONE ROTH - PS 3 # 4 // 
    
    class Square {
      float btnX;
      float btnY;
      float btnW;
      float btnH;
      float speed;
      
      Square(float btnX, float btnY, float btnW, float btnH) {
        this.btnX=btnX;
        this.btnY=btnY;
        this.btnW=btnW;
        this.btnH=btnH;
        this.speed=random(2, 5);
      }
    
    
      void display() {
    
        int space = 30;
        for (int i=0; i < 10; i = i+4) {
          float x = space + i * space;  
          float y = width/2; 
          float length = (i+1) * (mouseX/30);
          btnX+=random(-speed, speed);
          btnY+=random(-speed, speed);
          rect(btnX, btnY, btnW, btnH);
        }
    
    fill(#e83698);
      }
    }
    
    
    

    code

    tweaks (0)

    about this sketch

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

    license

    advertisement

    Simone Roth

    PS3_4

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

    You need to login/register to comment.