PImage img, msk; void setup(){ size(500, 500); background(255); smooth(); noStroke(); rectMode(CENTER); fill(0,0,0); for (int x = 13; x < 490; x += 25) { for (int y = 13; y < 490; y += 25 ) { pushMatrix(); translate(x, y); rotate(radians(((y-13)*25+x-13)/68.5)); rect(0, 0, 20, 10); popMatrix(); } } msk = createImage(500, 500, RGB); img = createImage(500, 500, RGB); for (int x = 0; x < 500; x++) { for (int y = 0; y < 500; y++ ) { int loc = x + y*msk.width; msk.pixels[loc] = get(x, y); img.pixels[loc] = color(255,255,255); } } } void draw(){ updateGraphics(); madoake(); } void updateGraphics(){ int x_p = int(random(475)); int y_p = int(random(475)); int s_x = int(random(20)); int s_y = int(random(20)); color c = color(frameCount * 20 % 255,random(100),100); for (int x = 0; x < 25; x++) { for (int y = 0; y < 25; y++ ) { int loc = (x_p+x) + (y_p+y)*img.width; int chk = (s_x*25+x) + (s_y*25+y)*msk.width; if( red(msk.pixels[chk]) == 0){ img.pixels[loc] = c; } } } } void madoake(){ loadPixels(); for (int x = 0; x < img.width; x++) { for (int y = 0; y < img.height; y++ ) { int loc = x + y*img.width; float r = red (img.pixels[loc]); float g = green (img.pixels[loc]); float b = blue (img.pixels[loc]); float distance = dist(x,y,mouseX,mouseY); float adjustBrightness = (100-distance)/100; r *= adjustBrightness; g *= adjustBrightness; b *= adjustBrightness; r = constrain(r,0,255); g = constrain(g,0,255); b = constrain(b,0,255); color c = color(r,g,b); pixels[loc] = c; } } updatePixels(); }