26 lines
475 B
Text
26 lines
475 B
Text
float x, y, px, py;
|
|
float theta;
|
|
float rotation;
|
|
|
|
void setup() {
|
|
size(300, 300);
|
|
x = y = px = py = theta = 0;
|
|
rotation = 0.1;
|
|
background(255);
|
|
}
|
|
|
|
void draw() {
|
|
// find coordinates with rotating reference frame
|
|
pushMatrix();
|
|
rotate(theta/PI);
|
|
x = screenX(theta, 0);
|
|
y = screenY(theta, 0);
|
|
popMatrix();
|
|
|
|
translate(width/2.0, height/2.0);
|
|
theta += rotation;
|
|
line(px, py, x, y);
|
|
px = x;
|
|
py = y;
|
|
if (theta>width/2.0) frameCount=-1; // start over
|
|
}
|