# Graphical doodah (Sample Programs)

Waw. 14 days without comment.
I guess Jim is also impacted by the shutdown...

I'll better hurry up an post something or people will think the forum died....

Well here it is. Nothing much. Just an effect I saw somewhere and wanted to recreate.
Don't forget to do an Edit/Beautify after copy/paste. It'll make it easier to read.
After starting the program, you need to click in the Graphical Output window...

# Graphical doodah
# by Uglymike
graphsize 1200,750
clg
fastgraphics
#array of circles
dim circlearray[126,5]
#array of colors
dim col[20]
col={white,black,red,darkred,green,darkgreen,blue,darkblue, cyan,darkcyan,purple, darkpurple,yellow,darkyellow,orange, darkorange, grey,darkgrey}
#counter
i=0
# starttime of program
oldmsec=msec
#wait for click in order to start
while mouseb=0
pause 0.1
end while
# loop endlessly
while 1=1
#do this for ALL possible circles
for i = 1 to 125
#look if circle non-initialized (or reset)
if circlearray[i,0]=0 then
#if free slot make sure you didn't do another one within the last 50 msec
if msec > oldmsec+20 then
# set circle to initialized, capture circle coords, chose random color, diameter= 2
circlearray[i,0]=1
circlearray[i,1]=mousex
circlearray[i,2]=mousey
circlearray[i,3]= col[int(rand*16)]
circlearray[i,4]=2
# set new circle counter
oldmsec= msec
endif
# if circle already initialized
else
circlearray[i,4]=circlearray[i,4]+2
# decrease alpha
coloridb = blauw(circlearray[i,3])
coloridg = groen(circlearray[i,3])
coloridr = rood(circlearray[i,3])
colorida= alpha(circlearray[i,3])
colorida= colorida-7
# if alpha less than 0, reinitialize circle
if colorida < 5 then
circlearray[i,0]=0
# if alpha not 0 then
else
#calculate new color value
circlearray[i,3]=(colorida*256*256*256)+(coloridr*256*256)+(coloridg*256)+coloridb
#draw circle
color circlearray[i,3]
circle circlearray[i,1],circlearray[i,2],circlearray[i,4]
endif
endif
next i
#Update all circles on screen
refresh
# pause 0.04 to clear the screen 25 times a second
pause 0.04
clg
# .... and start over
end while

function alpha(hexcol)
alpha = int(((hexcol/256)/256)/256)%256
end function

function rood(hexcol)
rood = int((hexcol/256)/256)%256
end function

function groen(hexcol)
groen = int(hexcol/256)%256
end function

function blauw(hexcol)
blauw = hexcol%256
end function