Bubble universe
| Author | Message | ||||
TassyJim![]() Guru Joined: 07/08/2011 Location: AustraliaPosts: 6496 |
Needs the speed of MMB for Windows I believe the original code was written by Paul Dunn - developer of SpecBas. It has done the rounds of many languages including QB64 and PureBasic 'bubble universe MMB4W OPTION EXPLICIT OPTION DEFAULT FLOAT DIM r,t,u,v,x,n, TAU DIM INTEGER i, j, hw, hh, col MODE 1 n = RND()*100+300 TAU = 6.283185307179586 r = TAU / (RND()*100+235) hw = MM.HRES / 2 hh = MM.VRES / 2 'Cls(RGB(0, 0, 0)) PAGE WRITE 1 DO CLS(RGB(0, 0, 0)) FOR i = 0 TO n FOR j = 0 TO n u = SIN(i + v) + SIN(r * i + x) v = COS(i + v) + COS(r * i + x) x = u + t Col = RGB(i AND &hFF, j AND &hFF, 99) PIXEL hw + u * hw * 0.4, hh + v * hh * 0.4, Col NEXT NEXT t = t + 0.01 PAGE COPY 1 TO 0 LOOP UNTIL INKEY$ <>"" ![]() Jim Edited 2023-01-06 14:53 by TassyJim VK7JH MMedit |
||||