Bubble Universe Demo
| Author | Message | ||||
| Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 777 |
Hi, I've optimised this code for a LCD display, it now runs at approx 2Hz on a Pico running at 378MHz. I've reduced the number of plotted pixels, each pixel is drawn, then at the next iteration un_drawn, rather than doing a complete screen clear, I've also made them larger, to be more visible on a small screen, it's still managing to display about 1700 point per screen update. ![]() Bubble video Unfortunately it does make the code more unreadable. :-( ' Bubble Universe Dim Float u,y,a,b,p,q,s,g,v=0, z=0, t=0, x=0 Dim Integer i,j,tt,c(41),d(41),e(41),f(41),l(41),m(41) Const w=MM.HRes/2, h=MM.VRes/2, o=h/2, n=255 Const k=RGB(black), r=(2*Pi)/235 CLS RGB(black):Backlight 95 Math Add m(),3,m():t=Rnd*10':tt=t+3 Do g=t:Inc t,0.025 For i=50 To n Step 5 b=0 For j=50 To n Step 5 a=r*i:p=i+z:q=a+y u=Sin(p)+Sin(q):z=Cos(p)+Cos(q) y=u+g:f(b)=w+u*o:l(b)=h+z*o 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 e(b)=RGB(i,j,130):Inc b,1 Next Box f(),l(),m(),m(),0,,k Box c(),d(),m(),m(),0,,e() Next i Loop ' Until t>tt Edited 2022-11-21 20:29 by Bleep |
||||