Bubble Universe Demo


Author Message
Bleep

Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 795
Posted: 08:00pm 21 Nov 2022      

You got me thinking, bad thing, so.. how about this, using my original of doing the plotting in blocks of 41, but storing the result in a 2D array, then using the Math Split and Insert to move chunks around, into 1D arrays for plotting, smooth animation and 350mS refresh :-) So close to 3Hz update...
' Bubble Universe
Dim Float u,a,p,q,t,v=0, x=0
Dim Integer g,b,i,j,c(41),d(41),e(41),n(41)
Dim Integer f(41,41),l(41,41),m(41,41)
Const w=MM.HRes/2, h=MM.VRes/2
Const r=(2*Pi)/235, o=h/2
CLS RGB(black):Backlight 95
t=Rnd*10:Math set 3,e()

g=0
For i=50 To 255 Step 5
b=0
For j=50 To 255 Step 5
 m(g,b)=RGB(i,j,130):Inc b
Next
Inc g
Next
Do
Inc t,0.025:g=0:Timer =0
For i=50 To 255 Step 5
b=0
a=r*i
Math Slice f(),g,,c()
Math Slice l(),g,,d()
Box c(),d(),e(),e(),0,,0
For j=50 To 255 Step 5
 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
 Inc b
Next
Math Slice m(),g,,n()
Box c(),d(),e(),e(),0,,n()
Math Insert f(),g,,c()
Math Insert l(),g,,d()
Inc g
Next i
Print Timer
Loop