Bubble Universe Demo


Author Message
Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 777
Posted: 04:40pm 21 Nov 2022      

Hi Volhout,
Here you go, it is very fractionally faster, but still basically 2Hz update, however the two arrays use up 28kB of memory, in theory the update should be smoother as it now updates a pixel at a time.
' Bubble Universe
Dim Float u,a,p,q,t,v=0, x=0
Dim Integer b,i,j,c(1764),d(1764)
Const w=MM.HRes/2, h=MM.VRes/2
Const r=(2*Pi)/235, o=h/2
Backlight 95:CLS RGB(black)
t=Rnd*10
Do
Inc t,0.025:b=0
For i=50 To 255 Step 5
For j=50 To 255 Step 5
 Box c(b),d(b),3,3,0,,0
 a=r*i:p=i+v:q=a+x
 u=Sin(p)+Sin(q):v=Cos(p)+Cos(q)
 x=u+t:c(b)=w+u*o:d(b)=h+v*o
 Box c(b),d(b),3,3,0,,RGB(i,j,130):Inc b,1
Next
Next i
Loop