Rosetta Code- polyspiral
A fun one, this! Only run the code if you can face flashing screens! Shown here are just some stills from an actual run... spent a fun hour on this one.
There are still quite a few Rosetta Code examples that can be coded in LB, although the 'low hanging fruit' ones are mostly done. I'd encourage people to look and try one!
There's lots of scope for varying colour, line width, etc- try making modifications.
'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.
'The 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.
global sScreens: sScreens =0
open "Polyspiral- let me run for a while!!" for graphics_nsb as #wg
#wg "trapclose [quit]"
#wg "down ; fill 180 180 250 ; color darkblue ; size 4"
#wg "when leftButtonDown saveScreen"
incr = 0.0
for iteration =0 to 9999
#wg "cls ; fill 180 180 250"
R = iteration mod 256
G = 50
B = 255 -R
#wg "color "; str$( R) +" " +str$( G) +" " +str$( B)
x1 = 250
y1 = 250
incr = (incr + 0.05) mod 360
length = 5
angle = incr
for i = 1 to 150
x2 = x1 + cos( angle *3.14159265 /180) * length
y2 = y1 + sin( angle *3.14159265 /180) * length
#wg "line "; x1; " "; y1; " "; x2; " "; y2
x1 = x2
y1 = y2
length = length + 3
angle = ( angle + incr) mod 360
sub saveScreen h$, x, y
#wg "getbmp scr 1 1 500 500"
'bmpsave "scr", "poly" +right$( "000" +str$( sScreens), 3) + ".bmp" 'un-rem to save screens
sScreens = sScreens +1