• fullscreen
  • sketch_jul05a.pde
  • // Pressing Control-R will render this sketch.
    float rx, ry;    // rectangle x- and y-coordinate
    float rd = 100;  // rectangle width
    float ex, ey;    // ellipse x- and y-coordinate
    float ed = 106;  // ellipse diameter
    void setup() {
      size(640, 360);
      // Set the x- and y-coordinates for the rectangle
      rx = width * 0.33 - rd/2;
      ry = height * 0.5 - rd/2;
      // Set the x- and y-coordinates for the ellipse
      ex = width * 0.66;
      ey = height * 0.5;
    void draw() {
     background(0, 0, 0);
          if ((mouseX>=rx)&&(mouseX<=rx+100)&&(mouseY>height * 0.5 - rd/2)&&(mouseY<height * 0.5 + rd/2)){background(239, 101, 68);}
          if ((mouseX<=ex+53)&&(mouseX>ex-53)&&(mouseY<=ey+53)&&(mouseY>ey-53)){background(61, 139, 214);}
      rect(rx, ry, rd, rd); ellipse(ex, ey, ed, ed);


    tweaks (0)

    about this sketch

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



    Report Sketch

    Report for inappropriate content

    Please provide details if possible:

    Your have successfully reported the sketch. Thank you very much for helping to keep OpenProcessing clean and tidy :)

    Make a Copyright Infringement claim

    Anika Niazi

    workshop 3

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

    6 Jul 2012
    The workshop assignment required you to "Design a reaction when the mouse moves over a rectangle and design a different action when the mouse moves over a circle." Your code now had the same action for both the ellipse and the rectangle (change the background color), please update your code to fulfill the workshop requirements.
    You need to login/register to comment.