local fn DoIt NSInteger i, t double length, incr, x1, y1, x2, y2, twopi, angle, w, h pen 2.0, fn ColorRed, NSLineCapStyleButt, NULL, 0 incr = 0 : twopi = 2 * pi w = 600 : h = 600 t = 150 while ( t > 0 ) incr = ( incr + 0.05 mod twopi ) x1 = w / 2 y1 = h / 2 length = 1.0 angle = incr line to x1, y1 cls for i = 1 to 300 x2 = x1 + cos( angle ) * length y2 = y1 + sin( angle ) * length line to x1, y1 to x2, y2 x1 = x2 : y1 = y2 length = length + 1.0 angle = ( angle + incr mod twopi ) next t-- wend end fn window 1, @"Rosetta Code Polyspiral", fn CGRectMake( 0, 0, 600, 600 ) WindowSetBackgroundColor( 1, fn ColorBlack ) fn DoIt HandleEvents