|
Post by bplus on Sept 24, 2021 20:38:42 GMT -5
Johnno56 quite taken with this. Here is some mods since last posted at QB64 forum: _Title "Plasma Message" ' b+ 2021-09-24 from Welcome.bas
Randomize Timer Const xmax = 1020 Const ymax = 250
_Define A-Z As INTEGER Dim Shared cN, pR!, pG!, pB!
Screen _NewImage(xmax, ymax, 32) _Delay .3 _ScreenMove _Middle Cls mess$ = "Welcome! Friends of Basic" w = 9 * Len(mess$): h = 17 _PrintString (1, 1), mess$ t& = _NewImage(w, h, 32) _PutImage , 0, t&, (0, 0)-Step(w, h) Cls _PutImage , t&, 0 'Line (0, 0)-Step(w, h), &HFFFFFF00, B ' check w, h
Dim p(xmax, ymax) black~& = Point(3, 3) For y = 0 To ymax - 1 For x = 0 To xmax - 1 If Point(x, y) <> black~& Then p(x, y) = 1 'PSet (x, y), &HFFFFFF00 End If Next Next
Cls resetPlasma While 1 For y = 0 To ymax - 1 Step 5 For x = 0 To xmax - 1 Step 5 If p(x + 2, y + 2) Then changePlasma Else Color 0 End If Line (x + 60, y)-Step(5, 5), , BF Next Next _Limit 10 lc = lc + 1 If lc Mod 50 = 0 Then resetPlasma Wend
Sub changePlasma () cN = cN + 1 Color _RGB(127 + 127 * Sin(pR! * .3 * cN), 127 + 127 * Sin(pG! * .3 * cN), 127 + 127 * Sin(pB! * .3 * cN)) End Sub
Sub resetPlasma () pR! = Rnd ^ 2: pG! = Rnd ^ 2: pB! = Rnd ^ 2 End Sub
Looks better when running through color cycles.
|
|
johnno56
Junior Member
Logic is the beginning of wisdom.
Posts: 85
|
Post by johnno56 on Sept 26, 2021 2:55:58 GMT -5
Didn't think that you would pass up on an opportunity to improve on a plasma program... Nicely done!
J
|
|