Bubble Universe Demo


Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11168
Posted: 05:11pm 21 Nov 2022      

Doesn't this now assume that the "pixel" you are zeroing doesn't sit where a new pixel has been previously placed?

Here is my version 375mSec per update  @ 378MHz  

' Bubble Universe
Dim Float u,a,p,q,t,v=0, x=0
Dim Integer b,i,j,c(1764),d(1764),e(1764),f(1764),cc(1764),dd(1764)
Math set 3,e()
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
Timer =0
b=0
For i=50 To 255 Step 5
 For j=50 To 255 Step 5
   f(b)=RGB(i,j,130)
   Inc b
 Next j
Next i
Do
 Print Timer
 Timer =0
 Inc t,0.025:b=0
 For i=50 To 255 Step 5
   a=r*i
   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:cc(b)=u*o+w:dd(b)=v*o+h
     Inc b
   Next
 Next
 Box c(),d(),e(),e(),0,,0
 Box cc(),dd(),e(),e(),0,,f()
 Math scale  cc(),1,c()
 Math scale dd(),1,d()
Loop

Edited 2022-11-22 04:04 by matherp