Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plasma Studies
#7
Somewhen about this time Ken starts or requests Lava Lamp:
Code: (Select All)
'Lava Lamp modified by Ken G. and from b+ and from SmallBASIC.   mod again B+
_Title "press spacebar" ' b+ 2020-01-20 translated and modified from SmallBASIC
'Plasma Magnifico - updated 2015-11-26 for Android
'This program creates a plasma surface, which looks oily or silky.

Const xmax = 250, 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, 40

Dim c(360) As _Unsigned Long, p(6) As xy, f(6)

restart:
r = Rnd: g = Rnd: b = Rnd: i = 0
For n = 1 To 2
    r1 = r: g1 = g: b1 = b
    Do: r = Rnd: Loop Until Abs(r - r1) > .2
    Do: g = Rnd: Loop Until Abs(g - g1) > .2
    Do: b = Rnd: Loop Until Abs(g - g1) > .2
    For m = 0 To 17: m1 = 17 - m
        f1 = (m * r) / 18: f2 = (m * g) / 18: f3 = (m * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
    Next
    For m = 0 To 17: m1 = 17 - m
        f1 = (m + m1 * r) / 18: f2 = (m + m1 * g) / 18: f3 = (m + m1 * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
    Next
    For m = 0 To 17: m1 = 17 - m
        f1 = (m1 + m * r) / 18: f2 = (m1 + m * g) / 18: f3 = (m1 + m * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
    Next
    For m = 0 To 17: m1 = 17 - m
        f1 = (m1 * r) / 18: f2 = (m1 * g) / 18: f3 = (m1 * b) / 18: c(i) = rgbf(f1, f2, f3): i = i + 1
    Next
Next

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

While _KeyDown(27) = 0
    Cls
    If InKey$ = " " Then GoTo restart
    For i = 0 To 2
        p(i).x = p(i).x + p(i).dx
        If p(i).x > xmax - 50 Or p(i).x < 50 Then p(i).dx = -p(i).dx
        p(i).y = p(i).y + p(i).dy
        If p(i).y > ymax + 100 Or p(i).y < -100 Then p(i).dy = -p(i).dy
    Next
    For y = 0 To ymax - 1 Step 2
        For x = 0 To xmax - 1 Step 2
            d = 0
            For n = 0 To 2
                dx = x - p(n).x: dy = y - p(n).y
                k = Sqr(dx * dx + dy * 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
    _Display
    _Limit 20
Wend

Function rgbf~& (n1, n2, n3)
    rgbf~& = _RGB32(n1 * 255, n2 * 255, n3 * 255)
End Function


Attached Files Image(s)
   
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: 6 Guest(s)