Demo: fun mouse graphic effect

SmallBASIC implementations: 

' Mouse springs v1.bas SmallBASIC MGA 2015-04-18
' Demo fun mouse graphics effect, developed on Windows 7-64
maxX=800:maxY=600 ' draw area
centerX=maxX/2:centerY=maxY/2 ' this is where the screen effect center is
maxR=40:dColor=1 ' Max Radius of Springs, ChangeColor
lowXY=maxR*2:highX=maxX-maxR*2:highY=maxY-maxR*2 ' mouse pen borders for effect
red=12:blue=9 ' some color commentary
locate 0,120 : ? "Mouse Springs v1.bas" ' a little title
locate 1,120 : ? "2015-04-18, MGA/B+" ' a little credit
locate 3,120 : ? "Move mouse around" ' a little description
locate 4,120 : ? "center of screen"
locate 5,120 : ? "to see the effect."
locate 7,120 : ? "press esc to END"
while 1 ' loop forever
rect 0,0,maxX,maxY,0 filled ' erase/blackout drawing area
for y=lowXY to highY step maxR ' update our little drawing area
for x=lowXY to highX step maxR ' according to where current mouse is
distance=((x-centerX)^2+(y-centerY)^2)^.5 ' calculate spring distance mouse
topRadius=distance/11 ' use this calculation for max spring radius
for radius=topRadius to 0 step -4 ' draw the spring according to distance from mouse
dColor*=-1 ' alternate red/blue for colorful spring
if dColor<0 then circle x,y,radius,1,red else circle x,y,radius,1,blue
next r
next x
next y
delay 50 'slow down the drawing

label doloop
k=inkey ' check to quit
if asc(k)=27 then locate 20,120: ? "END" :end ' if esc pressed then end
pen on 'check current mouse and record to variables
cmX=pen(10) 'current mouse X
cmY=pen(11) 'current mouse Y
pen off 'done checking mouse x,y, now check in borders
if cmX<highX and cmX>lowXY and cmY<highY and cmY>lowXY then centerX=cmX :centerY=cmY
'reduce flickering
if centerX=oldX and centerY=oldY then goto doloop else oldX=centerX :oldY=centerY
wend

last line before wend should be:
if cmX (less than sign) highX and cmX (greater than sign) lowXY and cmY (less than sign) highY and cmY (greater than sign) lowXY then centerX=cmX : centerY=cmY

all one line. That explains why some code copied from this site is messed up!

OK edited in Plain Text, it's the < and > signs that signal HTML.

I have another:

'ribbons.bas SmallBASIC Bpf 2015-04-16 B+
locate 5,90:? "Press and hold esc to quit"
locate 7,90:? "press any other for next curtain"
locate 9,90
while 1
for i=0 to 9
a = 122:b=rnd^2:c=rnd^2:d=rnd^2
for y=1 to 60:
for x=1 to 600
cl=RGB(a+a*sin(b*x),a+a*sin(c*x),a+a*sin(d*x))
pset x,i*60+y,cl
next x
next y
next i
k=inkey:if asc(k)=27 then ? "esc detected, good bye":end
pause 5
wend

I am B+ at Bpf.