Bubble Universe Demo


Author Message
Goksteroo
Senior Member

Joined: 15/03/2021
Location: Australia
Posts: 114
Posted: 01:27am 15 Nov 2022      

I found this little bit of basic code on Discord (Bubbles Demo and converted it to MMBasic. The result on my PC with MMB4W is spectacular. The code should run in any version of MM Basic's hardware - just need to change the mode it is to run in.

mode 11 'change to suit your monitor/hardware and MMB version
cls rgb(black)
n=255
r=(2*pi)/235
x=0
'y=0
v=0
t=0
sz=200
s=0
scrw=mm.hres
scrh=mm.vres
sw=scrw/sz
sh=scrh/sz
offset=scrh/4.5
do
page write 1
   cls
   for i=50 to n
     for j=50 to n
      u=sin(i+v)+sin(r*i+x)
      v=cos(i+v)+cos(r*i+x)
      x=u+t
      pixel scrw/2+u*offset,scrh/2+v*offset,rgb(i,j,100)
   next j
   next i
   t=t+.025
page copy 1 to 0,B
loop

uTube Video (washed out colours!)