This program contains procedures which allow you to fade any image up and down in the 16-colour modes.
If you run the program, a sequence of randomly coloured ellipse-based patterns will be displayed. Each will fade up from black, and then fade back down before the next appears. Although the patterns are pleasant to look at, they are only incidental, and serve simply to illustrate the fades.
To use the fade procedures in your own program, you will need to replace the two procedures PROCscreenPalette and PROCgeneratePattern. The first establishes the palette which will be used with the display. In the present example, a random palette is used. Your version of PROCscreenPalette should set up your own palette. The second procedure places the image on the screen. In the current program, a random pattern is drawn, but you might replace this with a *ScreenLoad to load a pixel-based image, or whatever.
The program's three procedures PROCstorePalette, PROCfadeIn and PROCfadeOut do all the work. The first stores the current palette in the array col%(i,j), and then sets all physical colours to black. PROCfadeIn brings the palette up from black to the stored values, while PROCfadeOut takes it back to black.
10 REM >Fader
20 REM Program Smooth Screen Fade
30 REM Version A 0.03
40 REM Author Ledger White
50 REM RISC User March 1989
60 REM Program Subject to Copyright
70 :
80 ON ERROR MODE 9:PRINT REPORT$;" @ line ";ERL:END
90 DIM col%(15,2)
100 MODE 9:OFF
110 X=RND(-TIME)
120 REPEAT
130 PROCscreenPalette
140 PROCstorePalette
150 PROCgeneratePattern
160 PROCfadeIn
170 PROCwait(200)
180 PROCfadeOut
190 UNTIL FALSE
200 :
210 DEFPROCscreenPalette
220 FOR X%=1 TO 15
230 COLOUR X%,16*RND(15),16*RND(15),16*RND(15)
240 NEXT
250 ENDPROC
260 :
270 DEFPROCgeneratePattern
280 GCOL 3,RND(15)
290 Z%=RND(30):M%=450
300 FOR E=11.25 TO 180 STEP 11.25
310 ELLIPSE FILL 640,512,Z%,M%,RAD(E)
320 NEXT
330 GCOL 3,RND(15)
340 Z%=RND(100):M%=250
350 FOR E=22.5 TO 180 STEP 22.5
360 ELLIPSE FILL 640,512,Z%,M%,RAD(E)
370 NEXT
380 ENDPROC
390 :
400 DEFPROCstorePalette
410 FOR logcol%=0 TO 15
420 SYS "OS_ReadPalette",logcol%,16 TO ,,palette
430 col%(logcol%,2)=palette>>>24
440 col%(logcol%,1)=(palette>>>16) AND &FF
450 col%(logcol%,0)=(palette>>>8) AND &FF
460 COLOUR logcol%,0,0,0
470 NEXT
480 ENDPROC
490 :
500 DEFPROCfadeIn
510 FOR x=0.0625 TO 1.01 STEP 0.0625
520 WAIT
530 FOR Y%=0 TO 15
540 COLOUR Y%,col%(Y%,0)*x,col%(Y%,1)*x,col%(Y%,2)*x
550 NEXT
560 NEXT
570 ENDPROC
580 :
590 DEFPROCwait(delay%)
600 T%=TIME
610 REPEAT
620 UNTIL TIME>T%+delay%
630 ENDPROC
640 :
650 DEFPROCfadeOut
660 FOR x=0.9375 TO -0.01 STEP -0.0625
670 WAIT
680 FOR Y%=0 TO 15
690 COLOUR Y%,col%(Y%,0)*x,col%(Y%,1)*x,col%(Y%,2)*x
700 NEXT
710 NEXT
720 CLS
730 ENDPROC
This very short program produces some quite stunning effects. It first creates a small sprite containing the 256 colours of a mode 13 screen. This is then plotted on the screen on the locus of a circle, which is itself turning around the inside of a larger ring. Parameters are chosen randomly, and each press of the space bar creates a new pattern. A very wide variety of effects is generated, though no screenshots will do them justice, because even if they convey the texture of a particular pattern, they can give no idea of the rippling movements created as the program runs.
10 REM >SpiroGrph
20 REM Program Spirograph Visuals
30 REM Version A 1.00
40 REM Author Mike Ironmonger
50 REM RISC User March 1989
60 REM Program Subject to Copyright
70 :
80 MODE 13:OFF
90 X%=0:Y%=0
100 FOR C%=0 TO 63
110 FOR T%=0 TO 3
120 GCOL C% TINT T%*64
130 POINT X%,Y%
140 Y%+=4:IF Y%=64 Y%=0:X%+=4
150 NEXT:NEXT
160 MOVE 0,0:MOVE 60,60
170 *SGET block
180 *SCHOOSE block
190 :
200 ORIGIN 610,482
210 REPEAT
220 CLS:S%=RND(200)
230 A=0:B=PI*RND(1):C=0:D=B*RND(1)
240 REPEAT
250 X%=250*SIN(A):Y%=250*COS(A)
260 PLOT &ED,X%+S%*SIN(C),Y%+S%*COS(C)
270 A+=B:C+=D
280 UNTIL INKEY$(0)<>""
290 UNTIL FALSE