/*involuto()
creates an involuted flow. this objects is randomly trailing,
it controls by a mouse position
*/
class involuto{
float x,y; //base position
float xp,yp; //position [called by pointer]
float radmo,themo; //controlled by mouse position
float thtv; //theta velocity
int tm; //timecount
int tmv=int(random(5,25)); //velocity
float thtm; //time-based theta
involuto(){
//no constructors here
}
void trail(){
xp=mouseX+sin(pt.xp);
yp=mouseY+sin(pt.yp);
radmo=sqrt(sq(250-xp)+sq(250-yp));
themo=atan2(250-xp,250-yp)*(180/PI);
thtv=random(-10,10);
themo+=thtv;
thtv*=random(0.995,1.005);
tm+=tmv*0.1;
thtm=tmv*sin(tm);
x=xp+radmo*cos(PI/180*(themo+thtm));
y=yp+radmo*sin(PI/180*(themo+thtm));
for(int a=0;a<tmv;a++){
stroke(0,0,0,32);
point(x-(x-xp)*sin(a),y-(y-yp)*sin(a));
}
}
}
/*pointer()
this simple class is have unique use, with calling it.
*/
class pointer{
float xp;
float yp;
pointer(){
//no constructors here
}
void trail(float xp0,float yp0){
xp=xp0;
yp=yp0;
}
}
/*point involute
created with processing 0135
by rce12
9 march 2008
- move your mouse to draw it
- click your mouse for freeze that
- wait a second(s) for quarter-clear screen
simple and unique. using a simple class for make it cool than
set position manually. squashy yellow background, black painting
and funky interaction make it isn't insane.
*/
int tfade=0;
involuto[] it;
int nmb=100;
pointer pt=new pointer();
boolean startnow=true;
void setup(){
size(500,500);
background(240,222,58);
it=new involuto[nmb];
for(int a=0;a<it.length;a++){
it[a]=new involuto();
}
}
void draw(){
if(startnow){
if(tfade++>100){
fill(240,222,58,50);
rect(0,0,width,height);
tfade=0;
}
pt.trail(0.0f,0.0f);
for(int a=0;a<nmb;a++){
it[a].trail();
}
}
}
void mousePressed(){
startnow=!startnow;
}