File: sliceanimation.kbs

package info (click to toggle)
basic256 0.9.6.69a-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 26,304 kB
  • sloc: cpp: 7,778; yacc: 926; lex: 575; sh: 21; makefile: 7
file content (54 lines) | stat: -rw-r--r-- 1,027 bytes parent folder | download | duplicates (3)
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