Message Boards Message Boards

[GIF] Just Squares (Pattern from spinning squares)

GROUPS:

Pattern from spinning squares

Just Squares

This one is very simple: just a bunch of identical squares turning in unison. I stumbled across the pattern with grid lines and negative space crosses more or less by accident, then just played around a bit sizes and shapes until I got something I liked. For most of the time I was just using an approximation to the special angles where things line up, but at the end I needed to find the exact angles, which are $\arccos(3/\sqrt{10})$ and $\arccos(1/\sqrt{10})$ (the difference between the two is $\arcsin(4/5)$, which is why that quantity shows up in the definition of t).

Here's the code:

smootheststep[t_] := -20 t^7 + 70 t^6 - 84 t^5 + 35 t^4;

DynamicModule[{t, cols = RGBColor /@ {"#393E46", "#EEEEEE"}},
 Animate[
  t = ArcCos[3/Sqrt[10]] + ArcSin[4/5] smootheststep[Clip[s, {0, 1}]];
  Graphics[{Thickness[.005], cols[[1]],
    Table[
     Line[
      Table[
       {Cos[θ + t + If[OddQ[2 j], π, 0]] + Sqrt[2]/2 i, Sin[θ + t + If[OddQ[2 j], π, 0]] + Sqrt[2] j},
       {θ, 0, 2 π, 2 π/4}]],
     {j, 0, 8, 1/2}, {i, -3, 13 - If[OddQ[2 j], 1/2, 0]}]},
   ImageSize -> 540, PlotRange -> {{1, 7}, {1, 7}}, 
   Background -> cols[[-1]]],
  {s, 0, 1}, AnimationDirection -> ForwardBackward]
 ]
POSTED BY: Clayton Shonkwiler
Answer
4 months ago

Group Abstract Group Abstract