02-07-2025, 05:46 AM
You will do as I say....
I really don't know what to call the above program. I *was* attempting to create a plasma-like bubble effect, similar to a lava lamp. Instead, I've created one of the most interesting little goofs that I've had the pleasure of creating for a very long time!
Everyone should test this one and see what can be accomplished in only 25 lines of code. Then, after everyone tries it out, the really smart people (which we all know excludes @Pete) should tell me HOW THE HECK??!!
Code: (Select All)
Screen _NewImage(640, 480, 32)
Dim As Integer x, y, r, g, b
Dim As Single t
Do
t = t + 0.2
For y = -240 To 240
For x = -320 To 320
r = Plasma(x, y, t) ' Red channel
g = Bubbles(x, y, t) ' Green channel
b = Plasma(x, y, t + 2) ' Blue channel
PSet (x + 320, y + 240), _RGB32(r, g, b)
Next x
Next y
_Display
_Limit 60 ' Limit to 60 frames per second
Loop Until InKey$ <> ""
System
Function Bubbles% (x As Single, y As Single, t As Single) ' Function to create bubble effect
Bubbles = 127 + 127 * Sin(Sqr((x - 320 * Sin(t / 5)) ^ 2 + (y - 240 * Cos(t / 7)) ^ 2) / 8 - t)
End Function
Function Plasma% (x As Single, y As Single, t As Single) ' Function to calculate plasma effect
Plasma = 127 + 127 * Sin(Sqr(x * x + y * y) / 8 - t)
End Function
I really don't know what to call the above program. I *was* attempting to create a plasma-like bubble effect, similar to a lava lamp. Instead, I've created one of the most interesting little goofs that I've had the pleasure of creating for a very long time!
Everyone should test this one and see what can be accomplished in only 25 lines of code. Then, after everyone tries it out, the really smart people (which we all know excludes @Pete) should tell me HOW THE HECK??!!