Class for glowing ellipse
in
Programming Questions
•
1 year ago
I've been having a look at some code at
http://forum.processing.org/topic/glow-effect-5-10-2010 and have modified so I can draw glowing ellipses on screen via mouseclicks. I am fairly new to processing and have tried turning this code into a class - but can't get it working...any help would be appreciated
PGraphics normalImage;
PImage glowImage;
PImage glowImage;
void setup() {
size(500,500);
normalImage = createGraphics(width,height,JAVA2D);
normalImage.beginDraw();
normalImage.smooth();
normalImage.stroke(34, 102,188,22);
normalImage.fill(34, 102,188,22);
normalImage.strokeWeight(2);
normalImage.endDraw();
}
void draw() {
background(0);
glowImage = normalImage.get(0,0,normalImage.width,normalImage.height);
glowImage.resize(0,width/4);
glowImage.filter(BLUR,2);
glowImage.resize(0,width);
image(glowImage,0,0);
image(glowImage,0,0);
image(normalImage,0,0);
}
void mouseReleased(){ // if mouse clicked
float rr = 20;
rr += random(100);
normalImage.beginDraw();
normalImage.ellipse(mouseX,mouseY,rr,rr);
normalImage.endDraw();
}
float rr = 20;
rr += random(100);
normalImage.beginDraw();
normalImage.ellipse(mouseX,mouseY,rr,rr);
normalImage.endDraw();
}
1