Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plasma Studies
#4
Here I find a new way to mix colors for Plasma and get away from Classic White high contrast:
Code: (Select All)
_Title "Color Mixing 4 Plasmatic" ' b+ 2020-01-23
' continued study of what makes Plasmatic tick, here the color pallete created

Const xmax = 800, ymax = 600
Type xy
    x As Single
    y As Single
    dx As Single
    dy As Single
End Type
Screen _NewImage(xmax, ymax, 32)
_ScreenMove 300, 10
Randomize Timer
Dim c(360) As _Unsigned Long, p(6) As xy, f(6), i As Integer, r As Integer, g As Integer, b As Integer, m As Integer
Dim r1 As Integer, g1 As Integer, b1 As Integer
Dim r2 As Integer, g2 As Integer, b2 As Integer
restart:
If mode < .5 Then
    r1 = Rnd * 255: g1 = Rnd * 255: b1 = Rnd * 255
    r2 = Rnd * 255: g2 = Rnd * 255: b2 = Rnd * 255
    t$ = "t to toggle Current Mode New Plasma Option:  Between Cell Color" + Str$(r1) + Str$(g1) + Str$(b1) + "   Center Cell Color " + Str$(r2) + Str$(g2) + Str$(b2)
Else
    r2 = 255: g2 = 255: b2 = 255 'regular Plasma
    r1 = 0: g1 = 0: b1 = 0
    t$ = "t to toggle Current Mode Traditional Plasma:   Between Cell Color" + Str$(r1) + Str$(g1) + Str$(b1) + "   Center Cell Color" + Str$(r2) + Str$(g2) + Str$(b2)
End If

For i = 0 To 360
    If i Mod 60 = 0 Then r = Rnd * 255: g = Rnd * 255: b = Rnd * 255
    m = i Mod 60
    Select Case m
        Case Is < 15: c(i) = midInk(r1, g1, b1, r, g, b, m / 15)
        Case Is < 30: c(i) = midInk(r, g, b, r2, g2, b2, (m - 15) / 15)
        Case Is < 45: c(i) = midInk(r2, g2, b2, r, g, b, (m - 30) / 15)
        Case Is < 60: c(i) = midInk(r, g, b, r1, g1, b1, (m - 45) / 15)
    End Select
Next

For n = 0 To 5
    p(n).x = Rnd * xmax: p(n).y = Rnd * ymax: p(n).dx = Rnd * 2 - 1: p(n).dy = Rnd * 2 - 1
    f(n) = .1 * Rnd
Next

While _KeyDown(27) = 0
    k$ = InKey$
    If k$ = " " Then GoTo restart
    If k$ = "t" Then mode = 1 - mode: GoTo restart
    t = Timer(.001)
    For i = 0 To 5
        p(i).x = p(i).x + p(i).dx
        If p(i).x > xmax Or p(i).x < 0 Then p(i).dx = -p(i).dx
        p(i).y = p(i).y + p(i).dy
        If p(i).y > ymax Or p(i).y < 0 Then p(i).dy = -p(i).dy
    Next
    _Title t$
    For y = 0 To ymax - 1 Step 2
        For x = 0 To xmax - 1 Step 2
            d = 0
            For n = 0 To 5
                dx = x - p(n).x: dy = y - p(n).y
                k = Sqr(dx * dx + dy * dy)
                'k = _HYPOT(dx, dy)
                d = d + (Sin(k * f(n)) + 1) / 2
            Next n: d = d * 60
            Line (x, y)-Step(2, 2), c(d), BF
        Next
    Next
    Locate 1, 1: Print Using "#.####"; Timer(.001) - t
    _Display
    '_LIMIT 100
Wend

Function midInk~& (r1%, g1%, b1%, r2%, g2%, b2%, fr##)
    midInk~& = _RGBA32(r1% + (r2% - r1%) * fr##, g1% + (g2% - g1%) * fr##, b1% + (b2% - b1%) * fr##, 255)
End Function

   
b = b + ...
Reply


Messages In This Thread
Plasma Studies - by bplus - 05-03-2022, 08:03 PM
RE: Plasma Studies - by bplus - 05-03-2022, 08:08 PM
RE: Plasma Studies - by bplus - 05-03-2022, 08:12 PM
RE: Plasma Studies - by bplus - 05-03-2022, 08:16 PM
RE: Plasma Studies - by bplus - 05-03-2022, 08:21 PM
RE: Plasma Studies - by bplus - 05-03-2022, 08:26 PM
RE: Plasma Studies - by bplus - 05-03-2022, 08:31 PM
RE: Plasma Studies - by bplus - 05-03-2022, 08:35 PM
RE: Plasma Studies - by bplus - 05-03-2022, 08:38 PM
RE: Plasma Studies - by bplus - 05-03-2022, 08:45 PM
RE: Plasma Studies - by bplus - 05-03-2022, 08:49 PM
RE: Plasma Studies - by Dav - 05-03-2022, 11:16 PM
RE: Plasma Studies - by bplus - 05-03-2022, 11:53 PM
RE: Plasma Studies - by Coolman - 05-04-2022, 11:00 AM
RE: Plasma Studies - by vince - 05-05-2022, 12:34 AM



Users browsing this thread: 2 Guest(s)