• fullscreen
  • sketch52028.pde
  • void setup() {
      size(501, 501);
      smooth();
    }
    
    int x, y;
    
    void draw() {
      background(0);
      for (int x = 10; x < 500; x = x+20) {
        for (int y = 10; y < 500; y = y+20) {
          //draw a lot of eyes
          fill(255);
          ellipse(x, y, 20, 20);
          //Eye balls
          int pX = (int) map(mouseX, 0, width, -6, 6);
          int pY = (int) map(mouseY, 0, height, -6, 6);
          //to limit mouseX and mouseY
          fill(0);
          ellipse(x + pX, y + pY, 5, 5);
          //Iris
        }
      }
    }

    code

    tweaks (0)

    about this sketch

    This sketch is running in HTML5 using Processingjs.

    license

    advertisement

    Xiongfei Zhang plus+

    Eyes_follow_mouse

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

    Eyes_follow_mouse

    Good use of the map function (I love that function).

    Good job.
    You need to login/register to comment.