• fullscreen
  • sketch52027.pde
  • float color1=0, color2=0, color3=0;
    
    void setup() {
      size(501, 501);
      smooth();
    }
    
    void draw() {
      background(255);
      for (int i = 10; i < 500; i = i+20) {
      for (int j = 10; j < 500; j = j+20) {
        noFill();
        ellipse(i, j,20,20);
        color1=mouseX;
        color2=mouseY;
        if (color1>=color2){
          color3=color1-color2;
        }else{
          color3=color2-color1;
        }
        fill(color1,color2,color3);
        ellipse(i,j,8,8);
      }
      }
    }

    code

    tweaks (0)

    about this sketch

    This sketch is running in HTML5 using Processingjs.

    license

    advertisement

    Xiongfei Zhang plus+

    Eyes_color_change

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

    For/next plus conditionals

    Don't neglect comments, Xiongfei. Your code is nice and compact, but needs some comments to clarify to future readers, etc...


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