Qbasicnews.com

Full Version: I was bored, so here are some circles...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
DEFINT A-Z
TYPE nana
r AS SINGLE
x AS INTEGER
y AS INTEGER
c AS INTEGER
END TYPE
SCREEN 13
RANDOMIZE TIMER
DIM cr(256) AS nana

cr(0).r = 220
cr(0).x = 160
cr(0).y = 100
cp = 1

'insane = 1  'unrem this for a nasty effect

DO
IF insane THEN
  cr(0).r = 220 + COS(cr(0).c) + SIN(cr(0).c)
  cr(0).x = COS(cr(0).c) * 10 + 160
  cr(0).y = SIN(cr(0).c) * 10 + 100
ELSE
  cr(0).r = 220 - cr(0).c / 10
  cr(0).x = 160
  cr(0).y = 100
END IF
cr(0).c = cr(0).c + cp
IF cr(0).c < 32 THEN cp = 1: cr(0).c = 32
IF cr(0).c > 103 THEN cp = -1: cr(0).c = 103
T! = TIMER
FOR a = 255 TO 0 STEP -1
  CIRCLE (cr(a + 1).x, cr(a + 1).y), cr(a + 1).r, 0
NEXT
FOR a = 255 TO 0 STEP -1
  cr(a + 1).r = cr(a).r - 1.002 * (cr(a).r / 10)
  cr(a + 1).x = cr(a).x
  cr(a + 1).y = cr(a).y
  cr(a + 1).c = cr(a).c
NEXT
FOR a = 255 TO 0 STEP -1
  IF cr(a + 1).r > 6 THEN CIRCLE (cr(a + 1).x, cr(a + 1).y), cr(a + 1).r, cr(a + 1).c
NEXT
IF insane = 1 THEN dla! = .01 ELSE dla! = .1
DO: LOOP UNTIL TIMER - T! >= dla!
LOOP WHILE INKEY$ = ""

Sorry for all the flicker, but this is something I threw togheter in like 2 minutes... not meant to be fancy...

Z!re likes to unrem the insane variable and stare at the screen for hours. This makes him smarter, and paranoid.
cool effect...I think the "nasty" version is better...cheers
Quote:cool effect...I think the "nasty" version is better...cheers

Same here. Although it'd be nice if the "distant" end in the animation moved around a bit.
Quote:Although it'd be nice if the "distant" end in the animation moved around a bit.
Ooops, they are supposed to *changes*

Code:
DEFINT A-Z
TYPE nana
r AS SINGLE
x AS INTEGER
y AS INTEGER
c AS INTEGER
END TYPE
SCREEN 13
RANDOMIZE TIMER
DIM cr(256) AS nana

cr(0).r = 220
cr(0).x = 160
cr(0).y = 100
cp = 1

'insane = 1  'unrem this for a nasty effect

DO
IF insane THEN
  cr(0).r = 220 + COS(cr(0).c) + SIN(cr(0).c)
  cr(0).x = COS(cr(0).c) * 10 + 160
  cr(0).y = SIN(cr(0).c) * 10 + 100
ELSE
  cr(0).r = 220 - cr(0).c / 10
  cr(0).x = cr(0).x + 5 * RND - 5 * RND
  cr(0).y = cr(0).y + 5 * RND - 5 * RND
END IF
cr(0).c = cr(0).c + cp
IF cr(0).c < 32 THEN cp = 1: cr(0).c = 32
IF cr(0).c > 103 THEN cp = -1: cr(0).c = 103
T! = TIMER
FOR a = 255 TO 0 STEP -1
  CIRCLE (cr(a + 1).x, cr(a + 1).y), cr(a + 1).r, 0
NEXT
FOR a = 255 TO 0 STEP -1
  cr(a + 1).r = cr(a).r - 1.002 * (cr(a).r / 10)
  cr(a + 1).x = cr(a).x
  cr(a + 1).y = cr(a).y
  cr(a + 1).c = cr(a).c
NEXT
FOR a = 255 TO 0 STEP -1
  IF cr(a + 1).r > 6 THEN CIRCLE (cr(a + 1).x, cr(a + 1).y), cr(a + 1).r, cr(a + 1).c
NEXT
IF insane = 1 THEN dla! = .01 ELSE dla! = .1
DO: LOOP UNTIL TIMER - T! >= dla!
LOOP WHILE INKEY$ = ""

[edit]Found silly bug, now it works and looks "nice" in both insane and non-insane