• fullscreen
  • hblod.pde
  • int pxS=3;// pixel size
    float[][] hues;// hue
    float[][] bris;// brightness
    
    void setup() {
      frameRate(30);
      size(300,300);
      colorMode(HSB);
      hues=new float[width/pxS][height/pxS];
      bris=new float[width/pxS][height/pxS];
      noStroke();
      for (int x=0;x<width/pxS;x++) {
        for (int y=0;y<height/pxS;y++) {
          hues[x][y]=0;
          bris[x][y]=0;
        }
      }
    }
    
    void draw() {
      for (int x=0;x<width/pxS;x++) {
        for (int y=0;y<height/pxS;y++) {
          if (mousePressed) {
            bris[x][y]+=max(30-dist(mouseX,mouseY,x*pxS,y*pxS),0)/10;
          }
          else{
            hues[x][y]+=max(30-dist(mouseX,mouseY,x*pxS,y*pxS),0)/10;
          }
          hues[x][y]=(hues[x][y]+0.2)%0xFF;// make it loop
          bris[x][y]=(bris[x][y]+0.3)%(0xFF*2);// make it loop nicely
          fill(hues[x][y],0xFF,abs(bris[x][y]-0xFF));
          rect(x*pxS,y*pxS,pxS,pxS);// draw the pixel
        }
      }
    }
    
    
    
    
    
    

    code

    tweaks (0)

    about this sketch

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

    license

    advertisement

    Yann van der Cruyssen

    Hblod

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

    Use the mouse
    No mouse button pressed = controls hue
    Mouse button pressed = controls brightness

    You need to login/register to comment.