Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Super Plasmas screen saver
#1
About a year ago, in bplus's cool Proggies thread, a few of us had some fun playing with a program showing a small handful of Sin/Cos plasmas.  I've added a bunch more to those, 20 patterns now,  and put together this little screen saver to show them all.  It will randomly show a different plasma pattern every 5 seconds.  Current plasma number is shown in TITLE bar.  You can skip to a new one by pressing SPACE.  ESC ends.  You can easily add one of your own, just add it to the SELECT CASE (and update the plasma select RND value).

- Dav

Code: (Select All)
'================
'SuperPlasmas.bas
'================
'Coded by Dav for QB64PE, NOV/2025

'Plasma screensaver using Sin/Cos patterns.
'Randomly shows 1 of 20 plasmas every few seconds.
'Current Plasma number used is shown in TITLE bar.
'You can press SPACE to skip to a new Plasma num.
'ESC ends.

Randomize Timer

Screen _NewImage(_DesktopHeight, Int(_DesktopHeight * .75), 32)

cx = _Width / 2
cy = _Height / 2

Do

    pulse = Sin(t) * .8 'pulse factor

    t = Timer
    If t - oldt >= 5 Then
        plasma = Int(Rnd * 20) + 1 'get a new plasma every 5 seconds
        oldt = t
    End If

    For y = 0 To _Height Step 4
        For x = 0 To _Width Step 4

            a = _Atan2(y - cy, x - cx) 'base angle

            Select Case plasma
                'old effects
                Case 1: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 2 + t) 'spiral twist
                Case 2: a = a + _Atan2(y - cy, x - cx) + Sin(t) * 4 'churning sin
                Case 3: a = a + _Atan2(y - cy, x - cx) + Cos(t) * 4 'churning cos
                Case 4: a = a + _Atan2(y - cy, x - cx) + Sin(t) * rad 'spiral radius
                Case 5: a = a + _Atan2(y - cy, x - cx) + Sin(t * 4 + (x / _Width)) * .5 'edge wave
                Case 6: a = a + _Atan2(y - cy, x - cx) + (x / _Width) * Sin(t) * 5 'distort
                Case 7: a = a + _Atan2(y - cy, x - cx) + Cos(t) * 3 + Sin(x / _Width + t * 3) 'better wave
                Case 8: a = a + _Atan2(y - cy, x - cx) + Sin(t * 2) * Cos(rad * 2) 'double twist!
                Case 9: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 1.5 + t * 4) 'inward spiral
                Case 10: a = a + _Atan2(y - cy, x - cx) + Sin(x * .01 + t) * Cos(y * .01 + t) 'mumps!
                    'new effects
                Case 11: a = a + _Atan2(y - cy, x - cx) + Sin(t * .5 + rad * .3) * 2 'slower spiral wave
                Case 12: a = a + _Atan2(y - cy, x - cx) + Cos(t * 1.5 + rad * .7) * 3 'another twist
                Case 13: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 4 + t * .8) * 1.5 'radial ripple
                Case 14: a = a + _Atan2(y - cy, x - cx) + Sin(x * .05 + t) * 2 'horizontal wave
                Case 15: a = a + _Atan2(y - cy, x - cx) + Cos(y * .05 + t) * 2 'vertical wave
                Case 16: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 6 + t * 1.2) * 2 'higher ripples
                Case 17: a = a + _Atan2(y - cy, x - cx) + Sin(x * .02 + t * 2) * Cos(y * .02 + t * 2) 'more wave
                Case 18: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 3 + t * 1.5) * Sin(rad * 3 + t * 1.5) 'more ripples
                Case 19: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 3 + t * 2) * 3 'wavy circles
                Case 20: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 6 + t) + Sin(a * 3 + t * 2) 'more wavy pattern
            End Select

            rad = Sqr((x - cx) ^ 2 + (y - cy) ^ 2) / 100

            'plasma colors
            r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 127 + 128
            g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t + 1)) * 127 + 128
            b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t + 2)) * 127 + 128
            r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 127 + 128
            g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t + 3)) * 127 + 128
            b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t + 4)) * 127 + 128

            'blend colors with pulse
            r = r1 * (1 - pulse) + r2 * pulse
            g = g1 * (1 - pulse) + g2 * pulse
            b = b1 * (1 - pulse) + b2 * pulse

            Line (x, y)-Step(3, 3), _RGBA(r, g, b, 150), BF

        Next
    Next

    Select Case InKey$
        Case Chr$(27): Exit Do
        Case Chr$(32)
            plasma = Int(Rnd * 20) + 1
            oldt = t
    End Select


    _Title "Plasma: " + Str$(plasma) + "  (SPACE changes, ESC Quits)"

    _Display
    _Limit 30

Loop
End

Find my programs here in Dav's QB64 Corner
Reply
#2
+1 nice additions, I am liking #17 looks new.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#3
Yes I like that one a lot, and 6 too.

I edited the code to lower the STEP and LINE STEP a bit, it was just too blocky looking as it was when trying it on my lower res laptop.  A little slower but looks better now.

- Dav

Find my programs here in Dav's QB64 Corner
Reply
#4
OK guess I ahve (<< i am getting more and more dyslexic with typing???) to check it out again. I noticed the more variations the more they started looking all alike in a way, kinda ironical or paradoxical reaction. Wink
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#5
[Image: image.png]

I like it!  I tried some easy additions to add variety.  I think even the monochromes look good!

Before 28 (end if):         colorshift = Int(Rnd * 8)

After line 62 ('plasma colors), replace 6 lines with this:
            Select Case colorshift
                Case 0 'original
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 127 + 128
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t + 1)) * 127 + 128
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t + 2)) * 127 + 128
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 127 + 128
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t + 3)) * 127 + 128
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t + 4)) * 127 + 128
                Case 1 'vivid (darker darks)
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 192 + 63
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t + 1)) * 192 + 63
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t + 2)) * 192 + 63
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 192 + 63
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t + 3)) * 192 + 63
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t + 4)) * 192 + 63
                Case 2 'red shift
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 127 + 128
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t + 1)) * 63 + 64
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t + 2)) * 63 + 64
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 127 + 128
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t + 3)) * 63 + 64
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t + 4)) * 63 + 64
                Case 3 'green shift
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 63 + 64
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t + 1)) * 127 + 128
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t + 2)) * 63 + 64
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 63 + 64
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t + 3)) * 127 + 128
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t + 4)) * 63 + 64
                Case 4 'blue shift
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 63 + 64
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t + 1)) * 63 + 64
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t + 2)) * 127 + 128
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 63 + 64
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t + 3)) * 63 + 64
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t + 4)) * 127 + 128
                Case 5 'monochrome gray shift
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 192 + 63
                    g1 = (Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    b1 = (Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 0)) * 192 + 63
                    g2 = (Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
                    b2 = (Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
                Case 6 'hercules green
                    r1 = 0 'r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 192 + 63
                    g1 = (Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    b1 = 0 'b1 = (Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    r2 = 0 'r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 0)) * 192 + 63
                    g2 = (Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
                    b2 = 0 'b2 = (Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
                Case 7 'hercules amber
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 192 + 63
                    g1 = r1 * 0.6 '(Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    b1 = r1 * 0.1 '(Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 0)) * 192 + 63
                    g2 = r2 * 0.6 '(Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
                    b2 = r2 * 0.1 '(Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
            End Select

Before 136 (End Select):  colorshift = Int(Rnd * 8)
Reply
#6
(11-12-2025, 07:19 PM)mstasak Wrote: ...
Add one of these changes for a bit of a brainache!

#1
                Case 1 'vivid (darker darks)
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 192 + 63
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t * 22 + 1)) * 192 + 63
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t * 39 + 2)) * 192 + 63
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 192 + 63
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t * 22 + 3)) * 192 + 63
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t * 39 + 4)) * 192 + 63
#2
                Case 1 'vivid (darker darks)
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 192 + 63
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t * 22 + 1)) * 192 + 63
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t * 39 + 2)) * 192 + 63
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 192 + 63
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t * 1 + 3)) * 192 + 63
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t * 1 + 4)) * 192 + 63

and maybe 61:  colorshift=1 to bypass randomization temporarily
Reply
#7
Hey, nice addition @mstasak!   Looks even better.  Thanks for the mod.

- Dav

Find my programs here in Dav's QB64 Corner
Reply
#8
I liked how mstasak color mod improved the looks, so I also added a mod to change the color brightness for more dynamics.

Right before the LINE call to finally draw the plasma, add this:

            'below changes color brightness over time
            'for added dynamics.
            brit = .85 + Sin(t * .6 + a * .001) * .6
            r = r * brit
            g = g * brit
            b = b * brit

@mstasak, with your permission, I will posted the update code with all the color mods, giving you credit in the code of course.

- Dav

Find my programs here in Dav's QB64 Corner
Reply
#9
(11-12-2025, 09:39 PM)Dav Wrote: with your permission...

- Dav
Oh sure, credit doesn't matter to me, just make it good.  Big Grin Maybe add colorshift description to the _Title string?  And long term, a pause key and fullscreen mode and perhaps an adjustable  speed and/or duration per plasma parameter might be nice.  (I say as if there was profit to be made, ha ha!  I bet it's been a long time since anyone sold a screen saver.  After Dark was awesome!)
Reply
#10
Thanks, mstasak.  Here's a new version with some additions, including your colorshift code.

In this one, current plasma num and colorshift used is shown in title bar.  I added so color brightness changing, to make it look more interesting.  If thats not desired you can remove the 'brit' stuff before the LINE call (I added brit to the alpha in the LINE call too)..

Press R to turn on/off rotation to auto-cycle through the plasmas.  Default is on.
Press N to go to next plasma (was space in old one).
Press C to change current colorshift used.
Press P to pause/un-pause program.
ESC quits.

- Dav

EDIT:  Added C to change colorshift

Code: (Select All)
'=================
'SuperPlasmas2b.bas
'=================
'Coded by Dav for QB64PE, NOV/2025

'CREDIT: colorshift code provided by mstasak (thanks!)

'This is a plasma screensaver of Sin/Cos patterns.
'Randomly shows colorshift = Int(Rnd * 8) 1 of 20 plasmas every few seconds.
'Current Plasma number used is shown in TITLE bar,
'as well as the colorshift currently used.

'Press N to skip to another plasma number.
'Press C to change colorshift
'Press R to turn On/Off plasma rotation.
'Press P to pause program.
'Press ESC to quit.

Randomize Timer

Screen _NewImage(_DesktopHeight, Int(_DesktopHeight * .75), 32)

cx = _Width / 2
cy = _Height / 2

rotation = 1 'auto cycle through different plasmas, default is ON

Do

    pulse = Sin(t) * .8 'pulse factor

    t = Timer

    If rotation = 1 Then
        If t - oldt >= 5 Then
            plasma = Int(Rnd * 20) + 1 'get a new plasma every 5 seconds
            colorshift = Int(Rnd * 8)
            oldt = t
        End If
    End If

    For y = 0 To _Height Step 5
        For x = 0 To _Width Step 5

            a = _Atan2(y - cy, x - cx) 'base angle

            Select Case plasma
                'old effects
                Case 1: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 2 + t) 'spiral twist
                Case 2: a = a + _Atan2(y - cy, x - cx) + Sin(t) * 4 'churning sin
                Case 3: a = a + _Atan2(y - cy, x - cx) + Cos(t) * 4 'churning cos
                Case 4: a = a + _Atan2(y - cy, x - cx) + Sin(t) * rad 'spiral radius
                Case 5: a = a + _Atan2(y - cy, x - cx) + Sin(t * 4 + (x / _Width)) * .5 'edge wave
                Case 6: a = a + _Atan2(y - cy, x - cx) + (x / _Width) * Sin(t) * 5 'distort
                Case 7: a = a + _Atan2(y - cy, x - cx) + Cos(t) * 3 + Sin(x / _Width + t * 3) 'better wave
                Case 8: a = a + _Atan2(y - cy, x - cx) + Sin(t * 2) * Cos(rad * 2) 'double twist!
                Case 9: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 1.5 + t * 4) 'inward spiral
                Case 10: a = a + _Atan2(y - cy, x - cx) + Sin(x * .01 + t) * Cos(y * .01 + t) 'mumps!
                    'new effects
                Case 11: a = a + _Atan2(y - cy, x - cx) + Sin(t * .5 + rad * .3) * 2 'slower spiral wave
                Case 12: a = a + _Atan2(y - cy, x - cx) + Cos(t * 1.5 + rad * .7) * 3 'another twist
                Case 13: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 4 + t * .8) * 1.5 'radial ripple
                Case 14: a = a + _Atan2(y - cy, x - cx) + Sin(x * .05 + t) * 2 'horizontal wave
                Case 15: a = a + _Atan2(y - cy, x - cx) + Cos(y * .05 + t) * 2 'vertical wave
                Case 16: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 6 + t * 1.2) * 2 'higher ripples
                Case 17: a = a + _Atan2(y - cy, x - cx) + Sin(x * .02 + t * 2) * Cos(y * .02 + t * 2) 'more wave
                Case 18: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 3 + t * 1.5) * Sin(rad * 3 + t * 1.5) 'more ripples
                Case 19: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 3 + t * 2) * 3 'wavy circles
                Case 20: a = a + _Atan2(y - cy, x - cx) + Sin(rad * 6 + t) + Sin(a * 3 + t * 2) 'more wavy pattern
            End Select

            rad = Sqr((x - cx) ^ 2 + (y - cy) ^ 2) / 100

            'plasma colors

            'colorshift mod/codes below provided by mstasak

            Select Case colorshift
                Case 0 'original
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 127 + 128
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t + 1)) * 127 + 128
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t + 2)) * 127 + 128
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 127 + 128
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t + 3)) * 127 + 128
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t + 4)) * 127 + 128
                    clr$ = "original"
                Case 1 'vivid (darker darks)
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 192 + 63
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t + 1)) * 192 + 63
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t + 2)) * 192 + 63
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 192 + 63
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t + 3)) * 192 + 63
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t + 4)) * 192 + 63
                    clr$ = "vivid - darker darks"
                Case 2 'red shift
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 127 + 128
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t + 1)) * 63 + 64
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t + 2)) * 63 + 64
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 127 + 128
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t + 3)) * 63 + 64
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t + 4)) * 63 + 64
                    clr$ = "red shift"
                Case 3 'green shift
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 63 + 64
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t + 1)) * 127 + 128
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t + 2)) * 63 + 64
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 63 + 64
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t + 3)) * 127 + 128
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t + 4)) * 63 + 64
                    clr$ = "green shift"
                Case 4 'blue shift
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 63 + 64
                    g1 = (Sin(rad * 2 + t + 1) + Sin(a * 5 + t + 1)) * 63 + 64
                    b1 = (Sin(rad * 2 + t + 2) + Sin(a * 5 + t + 2)) * 127 + 128
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 63 + 64
                    g2 = (Sin(rad * 3 + t + 2) + Sin(a * 3 + t + 3)) * 63 + 64
                    b2 = (Sin(rad * 3 + t + 4) + Sin(a * 3 + t + 4)) * 127 + 128
                    clr$ = "blue shift"
                Case 5 'monochrome gray shift
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 192 + 63
                    g1 = (Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    b1 = (Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 0)) * 192 + 63
                    g2 = (Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
                    b2 = (Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
                    clr$ = "monochrome gray"
                Case 6 'hercules green
                    r1 = 0 'r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 192 + 63
                    g1 = (Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    b1 = 0 'b1 = (Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    r2 = 0 'r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 0)) * 192 + 63
                    g2 = (Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
                    b2 = 0 'b2 = (Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
                    clr$ = "hercules green"
                Case 7 'hercules amber
                    r1 = (Sin(rad * 2 + t) + Sin(a * 5 + t)) * 192 + 63
                    g1 = r1 * 0.6 '(Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    b1 = r1 * 0.1 '(Sin(rad * 2 + t + 0) + Sin(a * 5 + t + 0)) * 192 + 63
                    r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 0)) * 192 + 63
                    g2 = r2 * 0.6 '(Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
                    b2 = r2 * 0.1 '(Sin(rad * 3 + t + 0) + Sin(a * 3 + t + 0)) * 192 + 63
                    clr$ = "hercules amber"
            End Select

            'blend colors with pulse
            r = r1 * (1 - pulse) + r2 * pulse
            g = g1 * (1 - pulse) + g2 * pulse
            b = b1 * (1 - pulse) + b2 * pulse


            'brit changes color brightness over time for added dynamics.
            brit = .85 + Sin(t * .6 + a * .001) * .6
            r = r * brit
            g = g * brit
            b = b * brit


            Line (x, y)-Step(4, 4), _RGBA(r, g, b, 155 * brit), BF

        Next
    Next

    k$ = UCase$(InKey$)
    If k$ <> "" Then
        If k$ = Chr$(27) Then Exit Do
        If k$ = "N" Then
            plasma = Int(Rnd * 20) + 1
            colorshift = Int(Rnd * 8)
            oldt = t
        End If
        If k$ = "C" Then colorshift = Int(Rnd * 8)
        If k$ = "R" Then
            Select Case rotation
                Case 1: rotation = 0
                Case Else: rotation = 1
            End Select
        End If
        If k$ = "P" Then Sleep
        _KeyClear
    End If


    title$ = "Plasma: " + Str$(plasma) + "  (C)olor: " + clr$ + ", (N)ext, (P)ause, (R}otation:"
    If rotation = 1 Then rot$ = "On" Else rot$ = "Off"
    _Title title$ + rot$

    _Display
    _Limit 30

Loop
End

Find my programs here in Dav's QB64 Corner
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Christmas Screen Saver (Hardware Accelerated) dcoterel 2 322 12-27-2025, 06:25 PM
Last Post: bplus
  aquascape screen saver ver1.1 kn0ne 0 566 04-23-2024, 10:20 PM
Last Post: kn0ne
  Space Orbs. Small screen saver. Dav 16 3,085 08-27-2023, 07:52 PM
Last Post: grymmjack
  Updated old Googly Eyes screen saver Dav 10 2,264 07-10-2023, 01:15 PM
Last Post: bplus

Forum Jump:


Users browsing this thread: 1 Guest(s)