Message Boards Message Boards

GROUPS:

[GiF] Disks all the way down

Posted 9 months ago
1236 Views
|
2 Replies
|
10 Total Likes
|

A non-mathematica friend of mine had an idea for this endless 3D animation, where the third dimension is simulated with 2D graphics, and I just coded it up:

enter image description here

Note the use of bit-wise logic ;)

f[t_]:=Module[{g},
    g[z_] := Module[{fs,w,n,m,x,y,c},
    If[z>0, For[
       w = (1/z*4000.); c = (Clip[#,{0,1}]&)/@({w/4/255,w/2/255,w/255,0.95}); fs = RGBColor@@c; i = z*z*2, 
       n = Mod[i,z]; m=IntegerPart[i/BitOr[z,0]]; i>0, i--;
         If[BitXor[Mod[n,2],Mod[m,2]]!=0,
          {x, y} = {(n-Mod[t,2]-1.)*w, (Sin[t]+m-1.)*w};
          Sow @ {fs, Disk[{x,y}, w/2.5]};
         ]
       ];g[z-6]
       ]]; Check[Reap[g[36]][[2,1]], {}]
]
Manipulate[Graphics[f[t], Axes -> False, Background -> Black, 
  PlotRange -> {{0, 1600}, {0, 1200}}, ImageSize -> 500], {t, 0, 2 \[Pi], .2}]

But any shape will do:

enter image description here

Happy New Years!

2 Replies

Really neat! Reminds me of the Fete des lumieres logo from 2016:

enter image description here

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract