02-08-2024, 07:59 PM
i have this version with little bit different colors
Code:
' Bubble universe
' ---------------
' Paul Dunn posted this code but for SpecBAS in a facebook group. It looked so cool that I had to
' rewrite it in n7.
constant TAU = 6.283185307179586
set window "Bubble universe", 512, 512
set redraw off
n = 200; r = TAU/235
x = 0; y = 0;
v = 0; t = 0;
hw = width(primary)/2; hh = height(primary)/2
while not keydown(KEY_ESCAPE)
set color 0, 0, 0
cls
for i = 0 to n for j = 0 to n
u = sin(i + v) + sin(r*i + x)
v = cos(i + v) + cos(r*i + x)
x = u + t
set color i, j, 99
set pixel hw + u*hw*0.4, hh + v*hh*0.4
next
t = t + 0.025
set caret hw, 4
set color 255, 255, 255
center "Press esc to exit ..."
fwait 60
redraw
wend