This entry of Clayton's has been out for quite a while, but let me just belatedly write in to say that the expression for the Line[]
can be simplified quite a bit:
Line[{{t, 1 - t}.verts[[{i, Mod[i - 3, n, 1]}]],
{t, 1 - t}.verts[[Mod[i + k + {0, 1}, n, 1]]]}]
where we use Mod[]
with an offset to find the required indices, instead of having to perform RotateLeft[]
/RotateRight[]
.
A slight modification of the original code gives a pretty variation:
DynamicModule[{n = 10, k = 6, r, verts,
cols = RGBColor /@ {"#00adb5", "#eeeeee", "#ff5722", "#303841"}},
Manipulate[r = Cos[s];
verts = Table[(1 - r (-1)^i)
AngleVector[2 ? (i - 1)/n - ? (r + 1)/8],
{i, n}];
Graphics[{Directive[Thickness[.0075], CapForm["Round"],
Opacity[.8]],
Table[{Blend[cols[[; ;-2]],
1 - Abs[11/5 t - 11/10]],
Line[{{t, 1 - t} .
verts[[{i, Mod[i - 5, n, 1]}]],
{t, 1 - t} .
verts[[Mod[i + k + {0, 1}, n, 1]]]}]},
{i, 1, n - 1, 2}, {t, 1/12, 11/12, 1/12}]},
PlotRange -> 3, ImageSize -> 540,
Background -> cols[[-1]]], {s, 0, 2 ?}]]