Probably the most useless snippet I've ever done, but the idea hit me last night and I just wanted to see how it'd turn out.
This displays several lines of text and, by using the mouse, will simulate the effect of moving a spotlight over the text. No images are overlayed, it merely parses the text and colors it accordingly to simulate the light.
Rem Project: Dark Basic Pro Project
Rem Created: Friday, October 15, 2010
Rem ***** Main Source File *****
hide mouse
dim stuff$(20)
for i = 1 to 20
stuff$(i) = "asldjlkajsdfkjasdlfkjaowirhgaognargajknrgajkerhgajfhndjgdfklgsdhflk"
next i
rem radius of spotlight
d# = 120
W = text width(" ")
H = text height(" ")
sync on
do
cls
if mouseclick() = 1 then inc d#, 0.5
if mouseclick() = 2 then dec d#, 0.5
if d# > 200 then d# = 200
if d# < 0 then d# = 0
rem starting Y-position
ty = 50
for s = 1 to array count(stuff$())
rem determine x-radius for this row(y-coordinate)
r = sqrt(d#^2 - (ty - mousey())^2)
rem starting X-position
tx = 50
rem determine length of text to the left and
rem outside the spotlight
x = ((mousex()-tx)/W) - (r/W)
t$ = left$(stuff$(s), x)
ink rgb(16,16,16),0
text tx, ty, t$
tx = tx + x*W
rem number of characters contained within
rem spotlight on this Y-coordinate
size = (r / W)*2
rem loop through characters contained within spotlight
for i = x+1 to x+size
rem determine distance of character from center of
rem spotlight and set color accordingly (char gets darker further from light)
e# = 1.0 - ((mousex()-tx)^2 + (mousey()-ty)^2) / (d#^2)
if e# > 1 then e# = 1
if e# < 0 then e# = 0
c = 239*e#
ink rgb(16+c, 16+c, 16+c), 0
text tx, ty, mid$(stuff$(s), i)
inc tx, W
next i
rem display remaining text outside of the spotlight on the right side
t$ = right$(stuff$(s), len(stuff$(s))-(x+size))
ink rgb(16,16,16),0
text tx, ty, t$
rem next line of text
inc ty, H
next s
ink rgb(0,255,0), 0
x = mousex()
y = mousey()
line x-3, y, x+3, y
line x, y-3, x, y+3
ink rgb(255,255,255),0
text 0,0, str$(screen fps())
sync
loop
"Any sufficiently advanced technology is indistinguishable from magic" ~ Arthur C. Clarke