We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › Bubbles and Squares
Page Index Toggle Pages: 1
Bubbles and Squares (Read 516 times)
Bubbles and Squares
Jan 27th, 2009, 6:59pm
 
Hello,

Im new to Processing and this is my first very simple work. Just move your mouse to create beautiful bubbles an squares! You can change color any time by clicking the mouse button.

Code:
void setup(){
size(1000,500);
background(0,0,0);
smooth();
}
int inter=14;
int c=0;
int d=inter/2;
int sizee=0;
int r=int(random(0,255));
int b=int(random(0,255));
int g=int(random(0,255));
void draw(){
if(c == inter){
ellipseMode(CENTER);
fill(r, b, g, 100);
stroke(r, b, g, 200);
sizee=int(random(25,125));
ellipse(mouseX + random(-50,50), mouseY + random(-50,50), sizee, sizee);
c=0;
}
if(d == inter){
rectMode(CENTER);
fill(r, b, g, 100);
stroke(r, b, g, 200);
sizee=int(random(25,125));
rect(mouseX + random(-50,50), mouseY + random(-50,50), sizee, sizee);
d=0;
}
}
void mouseMoved() {
c++;
if(c > inter){
c=0;
}
d++;
if(d > inter){
d=0;
}
}
void mouseClicked() {
r=int(random(0,255));
b=int(random(0,255));
g=int(random(0,255));
}

Re: Bubbles and Squares
Reply #1 - Jan 31st, 2009, 12:43am
 
My sculpture professor would say, "Repetition always works!" By which he meant that it was a cheap trick and we should try to be better. He didn't hold it against someone who did it well, though and I think this sketch works very nicely.
Page Index Toggle Pages: 1