final int quanti = 200;
final int GAP=50;
final color colore = color(0);
float X, Y,
X1, Y1,
X2, Y2,
X3, Y3;
void setup()
{
size(500, 500);
frameRate(30);
stroke(colore);
X =width/2; Y =height/2;
X1=GAP; Y1=height/2;
X2=width-GAP; Y2=height/2;
X3=X; Y3=Y;
inizia();
}
void mouseMoved()
{
inizia();
}
void inizia()
{
background(255);
X3 = mouseX;
Y3 = mouseY;
}
void draw()
{
for(int i=0; i < quanti; i++)
{
switch((int)random(3))
{
case 0: X=(X+X1)/2.0; Y=(Y+Y1)/2.0; break;
case 1: X=(X+X2)/2.0; Y=(Y+Y2)/2.0; break;
case 2: X=(X+X3)/2.0; Y=(Y+Y3)/2.0; break;
}
point(round(X), round(Y));
}
}