RosettaCodeData/Task/Archimedean-spiral/Processing/archimedean-spiral-4.processing
2023-07-01 13:44:08 -04:00

22 lines
386 B
Text

float px, py, x, y;
float theta;
float rotation;
void setup() {
size(300, 300);
px = py = x = y = theta = 0;
rotation = 0.1;
background(255);
}
void draw() {
translate(width/2.0, height/2.0);
x = theta*cos(theta/PI);
y = (theta)*sin(theta/PI);
line(x, y, px, py);
theta = theta + rotation;
px = x;
py = y;
// check restart
if (px>width/2.0) frameCount=-1;
}