xxxxxxxxxx
void setup() {
size(500, 500);
}
float x = 50;
float y = 450;
int cPoint;
int oldC;
void draw() {
// points
fill(255);
noStroke();
ellipse(50, 450, 15, 15);
ellipse(450, 450, 15, 15);
ellipse(50, 50, 15, 15);
ellipse(450, 50, 15, 15);
for (int i; i < 1000; i++) {
while (cPoint == oldC)
cPoint = int(random(3.9));
oldC = cPoint;
switch(cPoint) {
case 0:
x += (x - 50) / -2;
y += (y - 450) / -2;
break;
case 1:
x += (x - 450) / -2;
y += (y - 450) / -2;
break;
case 2:
x += (x - 50) / -2;
y += (y - 50) / -2;
break;
case 3:
x += (x - 450) / -2;
y += (y - 50) / -2;
break;
}
doty = new dot(x, y);
doty.render();
}
}
class dot {
float xp, yp;
dot(float x, y) {
xp = x;
yp = y;
}
void render() {
fill(0);
ellipse(xp, yp, 1, 1);
}
}