[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Two-liners; Corona & Halo



The pair of two-liners listed below are slight variations on the same
theme that give very different effects on the screen. The core alogoritm
repeatedly draws a circle of 2000 dots. The angle around the circle is at
random and to some extent so is the radius. Furthermore, there's a mild
amount of symmetry added to encourage dots to gather at four points around
the circle giving a ray effect. In 'Corona' the radius is determined by a
fixed value number plus another selected at random. The random number
(0-1) is squared to bias the number towards 0 which causes the dots to
crowd around the minimum radius. The effect is a black circle surrounded
by a bright corona. In 'Halo' a sign function has been added which causes
20% of the points to be _subtracted_ from the fixed radius rather than
added. This forms a star-like image in the center of the circle giving the
effect of a star surrounded by a halo.
 
========================================================================
 
 0  REM 'CORONA' A TWO-LINER BY JOHN L. GRAHAM. CONTROL-C TO STOP
 1  DIM A%(2001),B%(2001):A = 8 *  ATN (1):B = 40:C = 55: HGR2 : FOR D = 0
    TO 2500: HCOLOR= 3: FOR E = 0 TO 2000 STEP 2:F =  RND (1) ^ 2 * A:G =
    B +  RND (1) ^ 2 * C:H = G *  COS (F):I = G *  SIN (F):A%(E) = 140 +
    H:A%(E + 1) = 140 - H:B%(E) = 95 + I:B%(E + 1) = 95 - I: HPLOT
    A%(E),B%(E): HPLOT A%(E + 1),B%(E): HPLOT A%(E),B%(E + 1): HPLOT
    A%(E + 1),B%(E + 1): NEXT : HCOLOR= 0: FOR E = 0 TO 2000 STEP 2: HPLOT
    A%(E),B%(E)
 2  HPLOT A%(E + 1),B%(E): HPLOT A%(E),B%(E + 1): HPLOT A%(E + 1),
    B%(E + 1): NEXT : NEXT
 
========================================================================
 
 0  REM 'HALO' A TWO-LINER BY JOHN L. GRAHAM. CONTROL-C TO STOP
 1  DIM A%(2001),B%(2001):A = 8 *  ATN (1):B = 40:C = 55: HGR2 : FOR D = 0
    TO 2500: HCOLOR= 3: FOR E = 0 TO 2000 STEP 2:F =  RND (1) ^ 2 * A:
    G = B +  SGN ( RND (1) - 0.2) *  RND (1) ^ 2 * C:H = G *  COS (F):
    I = G *  SIN (F):A%(E) = 140 + H:A%(E + 1) = 140 - H:B%(E) = 95 +
    I:B%(E + 1) = 95 - I: HPLOT A%(E),B%(E): HPLOT A%(E + 1),B%(E): HPLOT
    A%(E),B%(E + 1): HPLOT A%(E + 1),B%(E + 1): NEXT : HCOLOR= 0: FOR E =
    0 TO 2000 STEP 2
 2  HPLOT A%(E),B%(E): HPLOT A%(E + 1),B%(E): HPLOT A%(E),B%(E + 1): HPLOT
    A%(E + 1),B%(E + 1): NEXT : NEXT
 
Have fun!
 
John