Skip to content

Instantly share code, notes, and snippets.

@TheBits
Created April 16, 2011 09:16
Show Gist options
  • Save TheBits/923006 to your computer and use it in GitHub Desktop.
Save TheBits/923006 to your computer and use it in GitHub Desktop.
Small Basic plasma
window_x = 320
window_y = 240
'GraphicsWindow.BackgroundColor = "Black"
GraphicsWindow.Title = "Plasma"
GraphicsWindow.Width = window_x
GraphicsWindow.Height = window_y
GraphicsWindow.Show()
t = Math.GetRandomNumber(1000) * 1.0
For i = 0 To window_x
For j = 0 to window_y
x = j / window_x
y = i / window_y
a1 = 8 * Math.Sin(2*x+t)
a2 = 7 * Math.Cos(2*x+t)
a3 = 6 * Math.Sin(2*x+t)
r = 127*(Math.Sin(a1*x+t-5*Math.Sin(t)/3)+Math.Cos(a1*y-t+8*Math.Sin(t)/6))
g = 127*(Math.Cos(a2*x-t+4*Math.Sin(t)/4)+Math.Sin(a2*y+t-7*Math.Sin(t)/7))
b = 127*(Math.Sin(a3*x+t-3*Math.Sin(t)/5)+Math.Cos(a3*y-t+6*Math.Sin(t)/8))
GraphicsWindow.SetPixel(i, j, GraphicsWindow.GetColorFromRGB(r, g, b))
EndFor
EndFor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment