A negative rate of growth is neat.
Code: Select all
'----------------------------------
' linear spiral
'----------------------------------
Dim As Integer xres, yres, xctr, yctr
Screeninfo xres, yres
Screenres xres, yres, 4
xctr = xres \ 2
yctr = yres \ 2
'----------------------------------
Dim As Double turns, steps_per_turn, rate_of_growth
Dim As Double vx, vy, t, sint, cost, temp, k, radius
'----------------------------------
' set the spiral parameters here
turns = 7
steps_per_turn = 90
rate_of_growth = 50 ' per turn
' spiral starting point is relative to centre
vx = 50
vy = 0
'----------------------------------
' precompute
radius = Sqr( vx*vx + vy*vy )
vx /= radius ' normalise start point vector
vy /= radius
Const As Double TwoPi = 8 * Atn( 1 )
t = TwoPi / steps_per_turn ' radians per step
cost = Cos( t )
sint = -Sin( t )
'----------------------------------
' now go round in ever-changing circles
Pset( radius * vx + xctr, radius * vy + yctr ), 0
For t = 0 To turns * steps_per_turn
k = radius + rate_of_growth * t / steps_per_turn
temp = vx
vx = temp * cost - vy * sint
vy = temp * sint + vy * cost
Line -( k * vx + xctr, k * vy + yctr ), 12
Next t
'----------------------------------
Sleep