# \[GIF\] ■□ (Rotating blocks)

**URL:** <https://community.wolfram.com/t/gif-rotating-blocks/17238>\
**Category:** Staff Picks\
**Tags:** computational-arts, geometry, graphics-and-visualization, staff-pick\
**Created:** [December 20, 2020, 6:14pm UTC](https://community.wolfram.com/t/gif-rotating-blocks/17238 "2020-12-20T18:14:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![claytonshonkwiler](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/claytonshonkwiler/32/24940_2.png) [@claytonshonkwiler](https://community.wolfram.com/u/claytonshonkwiler)\
**Post date:** [December 20, 2020, 6:14pm UTC](https://community.wolfram.com/t/gif-rotating-blocks/17238/1 "2020-12-20T18:14:56Z")

</div>

![cb6.gif](https://global.discourse-cdn.com/wolfram/original/3X/c/8/c81ad84aa9609ac2092abf14a6b16715cf9879ec.gif)

⬛⬜  
⬜⬛

Inspired by [Craig Kaplan](https://isohedral.ca)’s [Swirled Series](https://isohedral.ca/swirled-series-the-result/), 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}]
 ]

```

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [December 20, 2020, 9:40pm UTC](https://community.wolfram.com/t/gif-rotating-blocks/17238/2 "2020-12-20T21:40:55Z")

</div>

![news-congrads-kkluyshnik-02-04-19.jpg](https://global.discourse-cdn.com/wolfram/original/3X/6/a/6a310c2d0904616faf4e6e148260c9f29ab9f4eb.jpeg) – you have earned _ **Featured Contributor Badge** _ ![2015-11-02_10-07-11.png](https://global.discourse-cdn.com/wolfram/original/3X/5/0/50e59c9ead62f729e7130d3ea1482555a75602b6.png)

Your exceptional post has been selected for our editorial column _ **Staff Picks** _ [http://wolfr.am/StaffPicks](http://wolfr.am/StaffPicks) and [Your Profile](http://community.wolfram.com/web/claytonshonkwiler) is now distinguished by a _ **Featured Contributor Badge** _ and is displayed on the [Featured Contributor Board](https://community.wolfram.com/people). Thank you!

---

<div class="post-metadata">

**Author:** ![samcarrettie](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/samcarrettie/32/29668_2.png) [@samcarrettie](https://community.wolfram.com/u/samcarrettie)\
**Post date:** [December 20, 2020, 9:49pm UTC](https://community.wolfram.com/t/gif-rotating-blocks/17238/3 "2020-12-20T21:49:12Z")

</div>

Excellent! I missed your fun posts, [@Clayton](https://community.wolfram.com/web/claytonshonkwiler), good too see them again 🙂 BTW Swirled Series pages is really interesting. Thanks for sharing.
