Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DNA Animation
#4
Thats a nice effect, your swell control really makes it pop. I did one with a single ball orbiting another stationary one which used a similar swell control to what you're doing. It worked, but doesn't have the "wow" factor that yours has. I was toying with coming up with some sort of perspective engine, like what I used in my old star field generator, to control the swell and apparent positions of the balls.

PS: In the following, you'll notice that I'm swapping the display order when the orbiter crosses a quadrant in order to get the overlapping effect. Easy to do with two balls, way more challenging with a helix of multiple balls. You'd probably have to compute a "distance" from viewer for each ball, and then display in order from farthest to nearest. In that case your black fill circles would probably work.

Code: (Select All)
SCREEN _NEWIMAGE(1024, 512, 32)
DIM orb(1) AS LONG
a% = 0
b% = -1
r% = 200 '                                                      orbital radius

orb(0) = _NEWIMAGE(100, 100, 32) '                              create the circles
orb(1) = _NEWIMAGE(100, 100, 32)
FOR x% = 0 TO 1
    _DEST orb(x%)
    CLS
    _CLEARCOLOR &HF000000
    IF x% MOD 2 = 0 THEN c& = &HFFFFFF00 ELSE c& = &HFF00FF00
    FCirc 49, 49, 49, c&
NEXT x%
_DEST 0

DO
    CLS
    ang% = ang% + 1
    IF ang% > 359 THEN ang% = 0
    IF ang% = 90 OR ang% = 270 THEN SWAP a%, b% '               flip display order when orthogonal to view
    sw% = 10 * COS(_D2R(ang%)) '                                swell factor
    ps% = r% * SIN(_D2R(ang%)) '                                orbital radius position
    IF a% THEN '                                                set display order
        _PUTIMAGE (281, 206), orb(0)
        Image_Resize 285 + ps% + sw%, 206 + sw%, 385 + ps% - sw%, 306 - sw%, orb(1), 0, "c", "c"
    ELSE
        Image_Resize 285 + ps% + sw%, 206 + sw%, 385 + ps% - sw%, 306 - sw%, orb(1), 0, "c", "c"
        _PUTIMAGE (281, 206), orb(0)
    END IF
    _LIMIT 100
    _DISPLAY
LOOP UNTIL _KEYDOWN(27)

END

SUB FCirc (CX AS INTEGER, CY AS INTEGER, RR AS INTEGER, C AS _UNSIGNED LONG)
    DIM AS INTEGER R, RError, X, Y
    R = ABS(RR) '                                               radius value along positive x
    RError = -R '                                               opposite side of circle? negative x
    X = R '                                                     point along positive x position
    Y = 0 '                                                     starting at the equator
    IF R = 0 THEN PSET (CX, CY), C: EXIT SUB '                  zero radius is point, not circle
    LINE (CX - X, CY)-(CX + X, CY), C, BF '                     draw equatorial line
    WHILE X > Y
        RError = RError + Y * 2 + 1
        IF RError >= 0 THEN
            IF X <> Y + 1 THEN
                LINE (CX - Y, CY - X)-(CX + Y, CY - X), C, BF ' draw line above equator
                LINE (CX - Y, CY + X)-(CX + Y, CY + X), C, BF ' draw line below equator
            END IF
            X = X - 1
            RError = RError - X * 2
        END IF
        Y = Y + 1
        LINE (CX - X, CY - Y)-(CX + X, CY - Y), C, BF '         draw line north latitudes
        LINE (CX - X, CY + Y)-(CX + X, CY + Y), C, BF '         draw line south latitudes
    WEND
END SUB 'FCirc

SUB Image_Resize (xpos AS INTEGER, ypos AS INTEGER, xlim AS INTEGER, ylim AS INTEGER, i AS LONG, d AS LONG, xj AS STRING, yj AS STRING)
    DIM AS INTEGER xs, ys, xp, yp, xl, yl
    xp = xpos: yp = ypos: xl = xlim: yl = ylim '                isolate sent parameters from any changes
    DIM AS SINGLE rt, xrt, yrt
    xrt = (xl - xp) / _WIDTH(i) '                               width of area divided by width of image
    yrt = (yl - yp) / _HEIGHT(i) '                              height of area divided by height of image
    rt = -xrt * (xrt < yrt) - yrt * (yrt <= xrt) '              pick the smaller of the two ratios to fit area
    xs = _WIDTH(i) * rt '                                       final image size ratio in x
    ys = _HEIGHT(i) * rt '                                      final image size ratio in y
    xp = -xp * (xj = "l") - (_SHR(xl - xp, 1) + xp - _SHR(xs, 1)) * (xj = "c") - (xl - xs) * (xj = "r")
    xl = xp + xs
    yp = -yp * (yj = "u") - (_SHR(yl - yp, 1) + yp - _SHR(ys, 1)) * (yj = "c") - (yl - ys) * (yj = "d")
    yl = yp + ys
    _PUTIMAGE (xp, yp)-(xl, yl), i, d
END SUB 'Image_Resize
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Reply


Messages In This Thread
DNA Animation - by SierraKen - 07-31-2022, 01:28 AM
RE: DNA Animation - by bplus - 07-31-2022, 03:05 AM
RE: DNA Animation - by SierraKen - 07-31-2022, 03:13 AM
RE: DNA Animation - by OldMoses - 07-31-2022, 01:01 PM
RE: DNA Animation - by bplus - 07-31-2022, 02:51 PM
RE: DNA Animation - by SierraKen - 07-31-2022, 03:43 PM
RE: DNA Animation - by OldMoses - 07-31-2022, 04:12 PM
RE: DNA Animation - by SierraKen - 07-31-2022, 04:21 PM
RE: DNA Animation - by OldMoses - 07-31-2022, 04:47 PM
RE: DNA Animation - by Kernelpanic - 07-31-2022, 04:50 PM
RE: DNA Animation - by bplus - 07-31-2022, 05:05 PM
RE: DNA Animation - by OldMoses - 07-31-2022, 05:24 PM
RE: DNA Animation - by Kernelpanic - 07-31-2022, 06:07 PM
RE: DNA Animation - by SierraKen - 07-31-2022, 07:49 PM
RE: DNA Animation - by OldMoses - 07-31-2022, 08:42 PM
RE: DNA Animation - by SierraKen - 07-31-2022, 07:52 PM
RE: DNA Animation - by SierraKen - 07-31-2022, 09:51 PM
RE: DNA Animation - by OldMoses - 07-31-2022, 10:38 PM
RE: DNA Animation - by bplus - 07-31-2022, 11:10 PM
RE: DNA Animation - by OldMoses - 08-02-2022, 11:39 AM
RE: DNA Animation - by SierraKen - 08-01-2022, 01:03 AM
RE: DNA Animation - by OldMoses - 08-01-2022, 02:11 AM
RE: DNA Animation - by Kernelpanic - 08-01-2022, 12:09 PM
RE: DNA Animation - by James D Jarvis - 08-02-2022, 12:25 PM
RE: DNA Animation - by bplus - 08-02-2022, 03:21 PM
RE: DNA Animation - by SierraKen - 08-02-2022, 08:07 PM
RE: DNA Animation - by OldMoses - 08-02-2022, 09:53 PM



Users browsing this thread: 1 Guest(s)