• fullscreen
  • shapecontrol.pde
  • void setup() {
      size(500, 500);
    }
    
    void draw() {  
    
      background(200);
    
      fill(random(0, 255)+random(-mouseX, mouseY), random(0, 255)+random(-mouseX, pmouseX), random(0, 255)+random(-mouseY, pmouseY));
    
      triangle(pmouseX, pmouseY, pmouseX*0.5, pmouseY/3, pmouseY, pmouseX);
    
      fill(random(0, 255)+random(mouseX, mouseY), random(0, 255)+random(-mouseX, pmouseX), random(0, 255)+random(-mouseY, pmouseY));
    
      rect(pmouseY*0.44, pmouseX/3.2, pmouseY/4+height/4-pmouseX/5, pmouseX/5+width/5-pmouseY/4);
    
      if (keyPressed) {
        if (key=='a') {
          save("pic.jpg");
        }
      }
    }
    
    

    code

    tweaks (0)

    about this sketch

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

    license

    advertisement

    alex duan

    Shapes

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

    randomly colored rectangle and triangle; based on mouse position

    You need to login/register to comment.