1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
# sliceanimation.kbs
# 2010-05-08 j.m.reneau
# demonstration program of getslice function
# and putslice statements.
fastgraphics
# capture slice of red foreground and white background
clg
color red
gosub randomdraw
refresh
slice$ = getslice(100,100,100,100)
# draw a screen of yellow and black to
# draw slice onto
color yellow
rect 0,0,300,300
color black
gosub randomdraw
refresh
# initial place and direction
x = 0
dx = rand * 3 + 1
y = 0
dy = rand * 3 + 1
while true
# get new loction to put slise at
x = x + dx
if x < 0 or x > 200 then dx = dx * -1
y = y + dy
if y < 0 or y > 200 then dy = dy * -1
# get whet is there before putting slice
original$ = getslice(x,y,100,100)
# draw the slize with white as a transparent color
putslice x,y,slice$,black
refresh
# change it back to what it was before the slice
putslice x,y,original$
end while
end
randomdraw:
# crap on the screen for example
for t = 1 to 100
line rand * 300, rand * 300, rand * 300, rand * 300
next t
return
|