Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there a faster way to do this glow circle effect?
#7
How about something like this:

Code: (Select All)
SCREEN _NEWIMAGE(1000, 700, 32)

'draw a background
FOR x = 0 TO _WIDTH STEP 25
    FOR y = 0 TO _HEIGHT STEP 25
        LINE (x, y)-STEP(25, 25), _RGBA(RND * 255, RND * 255, RND * 255, 150), BF
    NEXT
NEXT

'copy screen as image
back& = _COPYIMAGE(_DISPLAY)

DO

    'get mouse input
    WHILE _MOUSEINPUT: WEND
    mx = _MOUSEX: my = _MOUSEY

    'place background first
    _PUTIMAGE (0, 0), back&

    'draw fadeout circle where mouse x/y is
    FadeCircle mx, my
    _DISPLAY
    _LIMIT 30

LOOP UNTIL INKEY$ <> ""


SUB FadeCircle (mx, my)
    STATIC CircleImage, FadeScreen, wide2
    IF CircleImage = 0 THEN
        wide = 450: wide2 = wide / 2
        CircleImage = _NEWIMAGE(wide, wide, 32)
        FadeScreen = _NEWIMAGE(_WIDTH, _HEIGHT, 32)
        d = _DEST
        _DEST CircleImage
        CLS , _RGB32(0, 0, 0)
        _DONTBLEND
        FOR i = 0 TO wide2 STEP .333
            CIRCLE (wide2, wide2), i, _RGBA32(0, 0, 0, i * (255 / wide2))
        NEXT
        _DEST d
    END IF
    CLS , _RGB32(0, 0, 0), FadeScreen
    _PUTIMAGE (mx - wide2, my - wide2), CircleImage, FadeScreen
    _PUTIMAGE , FadeScreen
END SUB

Predraw the faded circle.   Then just put that faded circle on a black screen, and then put that completed screen over your display.

This shouldn't take a lot of time of process.  At it's heart, it's nothing more than a CLS and 2 _PUTIMAGE commands at work, after the initial first call.

(Note that you can simply change the variable "WIDE" in the sub, if you want to change the size of the lightsource.  )
Reply


Messages In This Thread
RE: Is there a faster way to do this glow circle effect? - by SMcNeill - 06-16-2024, 04:58 PM



Users browsing this thread: 2 Guest(s)