Message Boards Message Boards

[GIF] ■□ (Rotating blocks)

Rotating blocks

⬛️⬜️
⬜️⬛️

Inspired by Craig Kaplan's Swirled Series, though it's far too late to be included (and not in the right format, anyway).

This uses ImageDifference and Rasterize to get the effect, though I'm sure there's a better way.

Here's the code for an interactive Manipulate version (because of ongoing bugs in how Wolfram Community renders special characters, I am leaving π as \[Pi]):

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

DynamicModule[{t, r = 3},
 Manipulate[
  t = Floor[Mod[s, 2 r + 1]] + smootheststep[Mod[s, 1]];
  ImageDifference[
   Rasterize[
    Graphics[
     {AbsoluteThickness[.25],
      Table[
       Polygon[
        {x, x} + # & /@ ({{-.25, -10}, {-.25, 10}, {.25, 10}, {.25, -10}}.
           RotationMatrix[If[s <= 2 r + 1, \[Pi]/2, 0] + \[Pi]/2 Clip[t - Abs[x + r], {0, 1}]])],
       {x, -r, r, 1}]},
     PlotRange -> r + .25, ImageSize -> 540]],
   Rasterize[
    Graphics[
     {AbsoluteThickness[.25],
      Table[
       Polygon[
        {{x - .25, -10}, {x - .25, 10}, {x + .25, 10}, {x + .25, -10}}.RotationMatrix[\[Pi]/2]],
       {x, -r, r, 1}]},
     PlotRange -> r + .25, ImageSize -> 540]]],
  {s, 0, 4 r + 2 - .001}]
 ]
2 Replies

Excellent! I missed your fun posts, @Clayton, good too see them again :-) BTW Swirled Series pages is really interesting. Thanks for sharing.

POSTED BY: Sam Carrettie

enter image description here -- you have earned Featured Contributor Badge enter image description here

Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: Moderation Team
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