home *** CD-ROM | disk | FTP | other *** search
- ! Lissa Box.
- !
- ! IBM PC version 2.0 copyright (c) 1988 by True BASIC, Inc.
- !
- set mode "ega"
- RANDOMIZE
- ASK MAX COLOR colormax
- LET colormax = Min(colormax,31)
-
- DIM r(15),g(15),b(15)
- CALL Init(r,g,b,colormax)
-
- SET WINDOW -1.3,1.55,-1.3,1.55
- CALL BackCycle(r,g,b,bc,back)
- if colormax = 1 then
- let boxcolor = 0
- else IF colormax<15 then
- SET BACK 17
- LET boxcolor = 2 !MEDRES, use red box
- ELSE
- LET boxcolor = 1 !color -- use various colors for boxes
- END IF
-
- DO
- IF mod(clock,300)=0 then CALL Reset
- LET x = sin(nx * i)
- LET y = cos(ny * i)
- LET i = i+.01
- LET clock = clock+1
- IF colormax>3 then
- LET boxcolor = boxcolor+1
- IF boxcolor=colormax then LET boxcolor=1
- IF cycleflag<>0 then CALL Cycle(r,g,b,xxx,colormax)
- END IF
- SET COLOR boxcolor
- BOX AREA x,x+.22,y,y+.22
- SET COLOR colormax
- BOX LINES x,x+.22,y,y+.22
- CALL BackCycle(r,g,b,bc,back)
- LOOP
-
- SUB Reset !choose another x,y for lissajous
- CLEAR
- LET nx = Round(7*rnd+1)
- LET ny = Round(9*rnd+1)
- IF nx=1 then LET nx = 3
- IF ny=1 then LET ny = 3
- IF nx=ny then LET nx = nx + 1
- IF rnd<.3 then LET cycleflag=0 else LET cycleflag=1
- END SUB
- END
-
- SUB Init(r(),g(),b(),colormax) !set 15 colors to rainbow
-
- MAT READ r, g, b
- DATA 1, 1, 1, .6, .3, 0, 0, 0, 0, 0, .3, .6, 1, 1, 1
- DATA .3, .6, 1, 1, 1, 1, 1, 1, .6, .3, 0, 0, 0, 0, 0
- DATA 0, 0, 0, 0, 0, .3, .6, 1, 1, 1, 1, 1, 1, .6, .3
-
- LET j = 1
- FOR i = 1 to colormax
- SET COLOR MIX(i) r(j), g(j), b(j)
- LET j = j + 1
- NEXT i
-
- END SUB
-
- SUB Cycle(r(),g(),b(),c,colormax) !cycle colors
- LET c1 = mod(c,14)+1
- LET j = c
- FOR i = colormax-1 to 1 step -1
- LET j = j-1
- IF j<1 then LET j=colormax-1
- SET COLOR MIX (i) r(j),g(j),b(j)
- NEXT i
- LET c = c1
- END SUB
-
- SUB BackCycle(r(),g(),b(),bc,back) !cycle background colors
- LET bc = bc-.125 !bc is intensity
- IF bc<0 then
- LET back = mod(back,14)+1
- LET bc = 1
- END IF
- LET back1 = mod(back,30)+1
- LET r1 = (bc*r(back)+(1-bc)*r(back1)) * .9
- LET g1 = (bc*g(back)+(1-bc)*g(back1)) * .6
- LET b1 = (bc*b(back)+(1-bc)*b(back1)) * .7
- SET COLOR MIX(0) r1, g1, b1
- END SUB
-