'=========================================================================== ' Subject: 3D ROTATING STARFIELD Date: 08-04-97 (01:22) ' Author: Paul Maunders Code: QB, QBasic, PDS ' Origin: Cyberax@hotmail.com Packet: GRAPHICS.ABC '=========================================================================== SCREEN 12 RANDOMIZE TIMER MaxStars = 60 PI = 3.141592654# Rad% = 360 / (2 * PI) YA% = 79 SB = .0001 'Magnification Accelerator ZA% = 0 'Roll Direction (Angle) SC = 0 'Magnification Factor HYP% = 300 'Maximum Size HS% = 320 'Middle X Co-ordinate VS% = 240 'Middle Y Co-ordinate Spike = 0 Lines = 0 DIM S%(1000, 10) 'Starting Co-ordinate (Relative Position) DIM P%(1000, 2) 'Current Co-ordinate DIM Old%(1000, 2) 'Previous Co-ordinate (Last Position) FOR STAR% = 1 TO 1000 S%(STAR%, 1) = INT(RND * 360) + 1 S%(STAR%, 2) = INT(RND * 360) + 1 S%(STAR%, 3) = INT(RND * HYP%) + 90 NEXT FOR REVS% = 1 TO 1000 'Revolutions FOR YY% = 1 TO 360 STEP 4 'Single Spin ZA% = ZA% + 1 'Change Roll Direction (Angle) FOR STAR% = 1 TO MaxStars SC = SC + SB 'Magnification Factor XA% = S%(STAR%, 1) 'Relative X position YA% = YY% + S%(STAR%, 2) 'Relative Y position + Spin Amount HYP% = S%(STAR%, 3) 'Relative Distance from Center Point XXX% = (COS(YA% / Rad%) * (COS(XA% / Rad%) * HYP%)) YYY% = ((SIN(XA% / Rad%) * HYP%) * ABS((SIN((90 - ZA%) / Rad%) * HYP%) / HYP%)) + ((COS((YA% + 90) / Rad%) * (COS(XA% / Rad%) * HYP%) * ABS((COS((90 - ZA%) / Rad%) * HYP%) / HYP%))) P%(STAR%, 1) = HS% + (XXX% * SC) 'Work out Position using Center Points + Position * Scale Factor P%(STAR%, 2) = VS% + (YYY% * SC) IF NOT INKEY$ = "" THEN END IF SC < -1 THEN SB = -SB IF SC > 1 THEN SB = -SB NEXT 'CLS FOR STAR% = 1 TO MaxStars PSET (Old%(STAR%, 1), Old%(STAR%, 2)), 0 PSET (P%(STAR%, 1), P%(STAR%, 2)), 15 IF Spike = 1 THEN LINE (Old%(STAR%, 1), Old%(STAR%, 2))-(HS%, VS%), 0 IF Spike = 1 THEN LINE (P%(STAR%, 1), P%(STAR%, 2))-(HS%, VS%), 15 IF Lines = 1 THEN col = col + 1: IF col > 15 THEN col = 1 IF Lines = 1 THEN LINE (Old%(STAR%, 1), Old%(STAR%, 2))-(Old%(STAR% + 1, 1), Old%(STAR% + 1, 2)), 0 IF Lines = 1 THEN LINE (P%(STAR%, 1), P%(STAR%, 2))-(P%(STAR% + 1, 1), P%(STAR% + 1, 2)), col Old%(STAR%, 1) = P%(STAR%, 1) Old%(STAR%, 2) = P%(STAR%, 2) NEXT NEXT NEXT