Using Thomas approach with koogs’ suggestion. Calling filter()
in draw()
is expensive.
@dan850 How would you use blend()
to get this effect?
This post is relevant: How to do this kind of gradient on shapes
Kf
final int RAD=80;
PImage img, img2, imgBlur;
PGraphics msk;
void setup() {
size(600, 600);
msk = createGraphics(width, height);
background(100, 0, 0);
noStroke();
for ( int t = 0; t < 100; t++) {
fill(random(200), random(200), random(200));
rect( random(width-20), random(height-20), 20, 20);
}
img = get();
imgBlur = img.get();
imgBlur.filter(BLUR, 7);
}
void draw() {
msk.beginDraw();
msk.background(255);
msk.fill(0);
msk.ellipse(mouseX, mouseY, RAD,RAD);
msk.endDraw();
background(img);
img2 = imgBlur.get();;
img2.mask(msk);
image( img2, 0, 0);
noFill();
stroke(0);
ellipse(mouseX, mouseY, RAD,RAD);
}