QB64 Phoenix Edition
Proggies - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Prolific Programmers (https://qb64phoenix.com/forum/forumdisplay.php?fid=26)
+---- Forum: bplus (https://qb64phoenix.com/forum/forumdisplay.php?fid=36)
+---- Thread: Proggies (/showthread.php?tid=162)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21


RE: Proggies - bplus - 07-17-2024

Whoa! wasn't expecting that, OK Smile

I see your mod and raise you a mod:
Code: (Select All)
_Title "Simple Patterns mod vince mod bplus" '  B+ 2024-07-17
Screen _NewImage(700, 700, 256)
_ScreenMove 300, 0
m = 2
restart:
For i = 0 To _Width - 1
    For j = 0 To _Height - 1
        x = i * .25: y = j * .25
        c = (x Mod m) Xor (y Mod m)
        PSet (i, j), c
    Next
Next
_Display
_Limit 1
m = m * 1.25
If m > 100 Then m = 2
GoTo restart

   


RE: Proggies - vince - 07-17-2024

nice B+, a long time ago i had a mod that cycled various "color = f(x, y)" renders -- bitwise function variants using AND/XOR tend to produce fractal-like patterns and sqr(x*x + y*y) obviously circles.  similarly to how you used "d - int(d)" to take the fractional part, you can also use periodic functions like SIN to modularize such patterns, ie "sin(x and y)" or "sin(x*x + y*y)"

now when you hit "color = f(x + sqr(-1)*y)" you start really modding


RE: Proggies - Dav - 08-30-2024

Some great patterns up there.  Great code.   Here's a simple little sin wave thing.  

Sin wave water.

- Dav

Code: (Select All)
'sinwavewater.bas
'Dav, AUG/2024

Screen _NewImage(800, 600, 32)

Do
    Cls
    For waves = 1 To 10
        For x = 0 To _Width
            'choose of two ways to float
            If waves Mod 2 Then
                y = (60 * waves) + (2 + waves) * Sin(x / (15 + waves) - Timer * waves)
            Else
                y = (60 * waves) + (2 + waves) * Sin(x / (15 + waves) + Timer * waves)
            End If
            Line (x, _Height)-(x, y), _RGB(waves, waves, 25 * waves)
        Next
    Next
    _Limit 30
    _Display
Loop Until InKey$ <> ""



RE: Proggies - bplus - 08-30-2024

+1 if I were to mod, I would give waves perspective: have them smaller and closer together as they approach horizon, not just linearly but 1/dist ^2. When waves are < 1 in height just go with a single color to horizon. They would likely go in same direction, instead of reversing as you have it??


RE: Proggies - Dav - 08-30-2024

Rip current!  Big Grin  Yeah, I’ll make a more realistic one.  

- Dav


RE: Proggies - Dav - 10-02-2024

Hey, bplus, I thought you may like like this little proggie since you have shared some really great plasmas here.  I wondered what it would look like to show more than one plasma effect using a pulse factor to blend them.  Here's a little example of that.

- Dav

Code: (Select All)

Screen _NewImage(800, 600, 32)

cx = _Width / 2
cy = _Height / 2

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

    For y = 0 To _Height Step 3
        For x = 0 To _Width Step 3
            a = _Atan2(y - cy, x - cx) + t
            rad = Sqr((x - cx) ^ 2 + (y - cy) ^ 2) / 100

            '1st 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

            '2nd plasma colors
            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 plasma colors using pulse factor
            r = r1 * (1 - pulse) + r2 * pulse
            g = g1 * (1 - pulse) + g2 * pulse
            b = b1 * (1 - pulse) + b2 * pulse

            Line (x, y)-Step(2, 2), _RGB(r, g, b), BF

        Next
    Next

    _Display
    _Limit 30

Loop Until InKey$ <> ""



RE: Proggies - bplus - 10-02-2024

+1 Interesting effect thanks, most colorful Smile

@Dav is "pulse" your name for the effect or did you see it somewhere else?

I am looking this over again to see if you can press a button to change the color set, no random selection at all, hmm... maybe we could fix that Big Grin

No? this colors by position so this can be done in B&W and might be fun with AND without shades of gray and see what happens.


RE: Proggies - Dav - 10-02-2024

I just called it pulse, it's short for a pulsating effect I've been playing with making different balls with a pulsating effect using sine wave to change it's size over time.

- Dav


RE: Proggies - bplus - 10-02-2024

OK here is a mod Smile

Code: (Select All)
_Title "bplus mod Dav 'Pulse' Plasma Blend,  go ahead and press a key, esc to quit.." ' b+ 2024-10-02
' thankyou Dav for nice blended plasma effect, now I play with it :D

Screen _NewImage(800, 600, 32)
_ScreenMove 250, 60
cx = _Width / 2
cy = _Height / 2
m1 = 9
m2 = 27
m3 = 3
Do
    If InKey$ <> "" Then
        m3 = Int(Rnd * 12)
        m = Int(Rnd * 3) + 2
        m1 = m * m3
        m2 = m * m1
    End If
    t = t + .01 ' mod
    pulse = Sin(t) * .8 'pulse factor

    For y = 0 To _Height Step 3
        For x = 0 To _Width Step 3
            a = _Atan2(y - cy, x - cx) + t
            rad = Sqr((x - cx) ^ 2 + (y - cy) ^ 2) / 100

            '1st plasma colors
            r1 = (Sin(rad * m3 + t) + Sin(a * m1 + t)) * 127 '+ 128
            g1 = (Sin(rad * m3 + t + 1) + Sin(a * m1 + t + 1)) * 127 '+ 128
            b1 = (Sin(rad * m3 + t + 2) + Sin(a * m1 + t + 2)) * 127 ' + 128

            '2nd plasma colors
            r2 = (Sin(rad * 3 + t) + Sin(a * 3 + t + 1)) * 127 + 128
            g2 = (Sin(rad * 3 + t + 2) + Sin(a * m2 + t + 3)) * 127 + 128
            b2 = (Sin(rad * 3 + t + 4) + Sin(a * m2 + t + 4)) * 127 + 128

            'Blend plasma colors using pulse factor
            r = r1 * (1 - pulse) + r2 * pulse
            g = g1 * (1 - pulse) + g2 * pulse
            b = b1 * (1 - pulse) + b2 * pulse

            Line (x, y)-Step(2, 2), _RGB(r, g, b), BF

        Next
    Next

    _Display
    _Limit 30

Loop Until _KeyDown(27)

BTW if you hit a key and see a blank black screen just hold on for a minute to see a special effect.


RE: Proggies - Dav - 10-02-2024

NICE!   Very pretty plasmas.

- Dav