'=========================================================================== ' Subject: SHAPE SHIFTING PLASMA Date: 10-20-98 (19:08) ' Author: Daniel Davies Code: QB, QBasic, PDS ' Origin: ia53@rapid.co.uk Packet: GRAPHICS.ABC '=========================================================================== 'SHAPESHIFTING PLASMA BY Daniel Davies 'this is a sinusoidal plasma which I wrote ages ago, and have optimised it 'so it can run at 320*200 in 256 colours, at 80fps when compiled and run on 'a p200. 'it actually plots every single pixel, as opposed to plotting groups of 'pixels in the same colour, which is what all my previous plasmas have done 'to keep the frame rate up. this plasma just uses a very highly optimised 'inner loop. 'my web page is at www.users.rapid.net.uk/ia53/ 'and I can be e-mailed at either ' ia53@rapid.co.uk ' or 'arclight@pagans.org DIM PLASMA%(80, 50) DIM sine1%(0 TO 360) DIM sine2%(0 TO 360) DIM sine3%(0 TO 360) DIM sine4%(0 TO 360) DIM red%(0 TO 255) DIM green%(0 TO 255) DIM blue%(0 TO 255) SCREEN 13 DEF SEG = &HA000 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% 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% rtd = 3.141592654# / 180 FOR y% = 0 TO 360 sine1%(y%) = -(31 * SIN((y% * 7) * rtd)) sine2%(y%) = -(6 * SIN((y% * 3) * rtd)) sine3%(y%) = (19 * SIN((y% * 10) * rtd)) sine4%(y%) = (44 * SIN((y% * 5) * rtd)) NEXT y% st# = TIMER DO s1tmp% = sine1%(0) s2tmp% = sine2%(360) s3tmp% = sine3%(0) s4tmp% = sine4%(360) FOR x% = 0 TO 359 sine1%(x%) = sine1%(x% + 1) sine3%(x%) = sine3%(x% + 1) sine2%(x%) = sine2%(359 - x%) sine4%(x%) = sine4%(359 - x%) NEXT x% sine1%(360) = s1tmp% sine2%(0) = s2tmp% sine3%(360) = s3tmp% sine4%(0) = s4tmp% FOR y% = 0 TO 199 st2% = sine3%(y%) + sine4%(y%) + 127 FOR x% = 0 TO 319 POKE xmod&, st2% - (sine1%(x%) + sine2%(x%)) xmod& = xmod& + 1 NEXT x% NEXT y% xmod& = 0 frame& = frame& + 1 LOOP WHILE INKEY$ = "" et# = TIMER PALETTE time# = et# - st# PRINT time# PRINT frame& PRINT frame& \ time# SLEEP