Viewing as LB generates the successive images is a bit slow and flickery unless you have a high-speed setup. I did only a few optimisations to speed it up as I knew I could use ImageMagick to do the work of converting screen images from BMP to animated GIF, deleting the separate images, and then called a web browser to show the animated GIF.
<<<<<< Remove the screen-saves and calling ImageMagick and browser if you don't want these parts!!
<<<<<< You'll also need to alter file addresses ( I use Linux and different directories) >>>>>>
<<<<<< I used timers to allow ImageMagick to do its work. Bit ugly. Still it all takes under 2 minutes.
'nomainwin
WindowWidth =510
WindowHeight =530
open "Wavy" for graphics_nsb as #wg
#wg "trapclose [quit]"
#wg "down"
print "Starting image production"
#wg "cls ; fill 150 200 255"
for x =1 to 20 step 1
for y =1 to 20 step 1
#wg "up ; goto "; 40 +20 *x; " "; 40 +20 *y; " ; down ; color 220 220 220 ; circle 20"
next y
next x
#wg "flush"
#wg "getbmp scr0 1 1 510 530"
bmpsave "scr0", "scr00.bmp"
#wg "color 0 0 255 ; size 8"
scaler =20 /360
for phase =0 to 360 step 10
#wg "down ; drawbmp scr0 1 1 ; flush"
for x =1 to 20 step 1
for y =1 to 20 step 1
call spot x, y, phase +x /scaler +y /scaler
next y
next x
#wg "flush ; getbmp scr 1 1 510 530"
bmpsave "scr", "scr" +right$( "00" +str$( int( phase /10)), 2) +".bmp"
print ".";
next phase
timer 20000, [on]
wait
[on]
timer 0
print ""
command$ ="mogrify -format jpg D:\*.bmp" 'direct fails ( WHY??)
print command$
run "cmd.exe /c "; chr$( 34); command$; chr$( 34), HIDE
' Give it 60 seconds to execute (may not be enough for large images)
timer 20000, [on0]
wait
[on0]
timer 0
command$ ="convert -delay 50 D:\*.jpg animSpots.gif"
print command$
run "cmd.exe /c "; chr$( 34); command$; chr$( 34), HIDE
' Give it 60 seconds to execute (may not be enough for large images)
timer 60000, [on1]
wait
[on1]
timer 0
'modify following in a loop to remove intermediate bits...
for i =0 to 36
kill "D:\scr" +right$( "00" +str$( i), 2) +".bmp"
print "Deleting "; "scr" +right$( "00" +str$( i), 2) +".bmp"
kill "D:\scr" +right$( "00" +str$( i), 2) +".jpg"
print "Deleting "; "scr" +right$( "00" +str$( i), 2) +".jpg"
next i
run "C:\Program Files (x86)\Mozilla Firefox\Firefox.exe " + chr$(34) + "animSpots.gif" + chr$(34)
print "Done."
wait
sub spot x, y, phase
xs =40 +20 *x +20 *sinrad( phase)
ys =40 +20 *y +20 *cosrad( phase)
#wg "set "; xs; " "; ys
end sub
function sinrad( th)
sinrad =sin( th /180 *3.14159265)
end function
function cosrad( th)
cosrad =cos( th /180 *3.14159265)
end function
[quit]
close #wg
end