'=========================================================================== ' Subject: SINUSOIDAL PALETTE GENERATOR Date: 05-24-97 (15:20) ' Author: Daniel Davies Code: QB, QBasic, PDS ' Origin: ia53@rapid.co.uk Packet: GRAPHICS.ABC '=========================================================================== 'SINUSOIDAL PALLETTE GENERATOR 'This plasma uses moving sine waves to generate the pallette, making for an 'interesting effect. 'If you want a routine to generate a plasma, don't use this, it's unoptimised 'and I can write one which runs hundreds of times faster, using lookup tables 'and other tricks. 'I haven't got a web site yet but I've almost finished it, but in the meantime 'if you want to contact me, my email address is - ia53@rapid.co.uk SCREEN 13 DEF SEG = &HA000 sfactor% = 3 FOR y% = 0 TO 199 q% = (SIN(y% * sfactor% * (3.141592653# / 180)) * 50) FOR x% = 0 TO 319 POKE z& + x%, (SIN(x% * sfactor% * (3.141592653# / 180)) * 50) - q% + 127 NEXT x% z& = z& + 320& NEXT y% DIM rsin1%(360) DIM rsin2%(360) DIM rsin3%(360) DIM gsin1%(360) DIM gsin2%(360) DIM gsin3%(360) DIM bsin1%(360) DIM bsin2%(360) DIM bsin3%(360) FOR x% = 0 TO 360 rsin1%(x%) = (SIN(x% * 2 * (3.141592653# / 180)) * 17) rsin2%(x%) = (SIN(x% * 4 * (3.141592653# / 180)) * 13) rsin3%(x%) = (SIN(x% * 6 * (3.141592653# / 180)) * 7) gsin1%(x%) = (SIN((x% + 120) * 2 * (3.141592653# / 180)) * 17) gsin2%(x%) = (SIN((x% + 120) * 4 * (3.141592653# / 180)) * 13) gsin3%(x%) = (SIN((x% + 120) * 6 * (3.141592653# / 180)) * 7) bsin1%(x%) = (SIN((x% + 240) * 2 * (3.141592653# / 180)) * 17) bsin2%(x%) = (SIN((x% + 240) * 4 * (3.141592653# / 180)) * 13) bsin3%(x%) = (SIN((x% + 240) * 6 * (3.141592653# / 180)) * 7) NEXT x% DO WAIT &H3DA, 8 FOR x% = 0 TO 255 OUT &H3C8, x% OUT &H3C9, rsin1%(x%) + rsin2%(x%) + rsin3%(x%) + 30 OUT &H3C9, gsin1%(x%) + gsin2%(x%) + gsin3%(x%) + 30 OUT &H3C9, bsin1%(x%) + bsin2%(x%) + bsin3%(x%) + 30 NEXT x% r1tmp% = rsin1%(0) r3tmp% = rsin3%(0) g2tmp% = gsin2%(0) b1tmp% = bsin1%(0) b3tmp% = bsin3%(0) r2tmp% = rsin2%(360) g1tmp% = gsin1%(360) g3tmp% = gsin3%(360) b2tmp% = bsin2%(360) FOR x% = 0 TO 359 rsin1%(x%) = rsin1%(x% + 1) rsin3%(x%) = rsin3%(x% + 1) gsin2%(x%) = gsin2%(x% + 1) bsin1%(x%) = bsin1%(x% + 1) bsin3%(x%) = bsin3%(x% + 1) NEXT x% FOR x% = 360 TO 1 STEP -1 rsin2%(x%) = rsin2%(x% - 1) gsin1%(x%) = gsin1%(x% - 1) gsin3%(x%) = gsin3%(x% - 1) bsin2%(x%) = bsin2%(x% - 1) NEXT x% rsin1%(360) = r1tmp% rsin3%(360) = r3tmp% gsin2%(360) = g2tmp% bsin1%(360) = b1tmp% bsin3%(360) = b3tmp% rsin2%(0) = r2tmp% gsin1%(0) = g1tmp% gsin3%(0) = g3tmp% bsin2%(0) = b2tmp% LOOP WHILE INKEY$ = ""