A Polyspiral is a spiral made of multiple line segments, whereby each segment is larger (or smaller) than the previous one by a given amount. Each segment also changes direction at a given angle.



Task
Animate a series of polyspirals, by drawing a complete spiral then incrementing the angle, and (after clearing the background) drawing the next, and so on. Every spiral will be a frame of the animation. The animation may stop as it goes full circle or continue indefinitely. The given input values may be varied.

If animation is not practical in your programming environment, you may show a single frame instead.



Pseudo code
    set incr to 0.0

    // animation loop
    WHILE true 

        incr = (incr + 0.05) MOD 360
        x = width / 2
        y = height / 2
        length = 5
        angle = incr

        // spiral loop
        FOR 1 TO 150
            drawline
            change direction by angle
            length = length + 3
            angle = (angle + incr) MOD 360
        ENDFOR
    



100 PROGRAM "PolySp.bas"
110 OPTION ANGLE DEGREES
120 LET CH=2
130 SET VIDEO X 40:SET VIDEO Y 27:SET VIDEO MODE 1:SET VIDEO COLOR 0
140 OPEN #1:"video:"
150 OPEN #2:"video:"
160 WHEN EXCEPTION USE POSERROR
170   FOR ANG=40 TO 150 STEP 2
180     IF CH=2 THEN
190       LET CH=1
200     ELSE
210       LET CH=2
220     END IF
230     CLEAR #CH
240     PLOT #CH:640,468,ANGLE 180;
250     FOR D=12 TO 740 STEP 4
260       PLOT #CH:FORWARD D,RIGHT ANG;
270     NEXT
280     DISPLAY #CH:AT 1 FROM 1 TO 27
290   NEXT
300 END WHEN
310 HANDLER POSERROR
320   LET D=740
330   CONTINUE
340 END HANDLER