Skip to content

Instantly share code, notes, and snippets.

@shonkwiler
Last active August 30, 2019 21:59
Show Gist options
  • Save shonkwiler/bba80f8b648c9c98bcd8fee245ca37ca to your computer and use it in GitHub Desktop.
Save shonkwiler/bba80f8b648c9c98bcd8fee245ca37ca to your computer and use it in GitHub Desktop.
(* Mathematica code for the GIF "Reinvention" by Clayton Shonkwiler, which
you can see here: https://shonk.tumblr.com/post/142103728586 *)
tiles = Module[{n = 3, cols, f},
cols = RGBColor /@ {"#bcd6c0", "#f56791", "#46454d"};
f[θ_] := Piecewise[
{{0, θ < 0}, {π/6 (1/2 - 1/2 Cos[π θ]), 0 <= θ < 1},
{π/6, 1 <= θ < 2}, {π/6 (3/2 - 1/2 Cos[π θ]), 2 <= θ < 3}, {π/3, θ >= 3}}];
ParallelTable[
Graphics[{Thickness[.005],
Table[
{Blend[cols[[{1, 2, 1}]], 3/π f[(j + 3)/6 + θ]],
Line[{Sqrt[3] (i + (-1)^j/4), 3/2 j} + # & /@ {#, -#}
&[{Cos[2 π k/n + (-1)^(i + j) f[(j + 3)/6 + θ]],
Sin[2 π k/n + (-1)^(i + j) f[(j + 3)/6 + θ]]}]]},
{i, -3, 3}, {j, -3, 3}, {k, 0, 2}]},
PlotRange -> 5, ImageSize -> 540, Background -> cols[[3]]],
{θ, -1., 3 - #, #}] &[4/100]
];
Export[NotebookDirectory[] <> "tiles.gif", tiles, "DisplayDurations" -> {1/24}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment