# [GIF] Come Together (Spinning hexagons)

Posted 3 years ago
4522 Views
|
|
9 Total Likes
|
 Come TogetherAn offshoot of another project which may become a thing some day. The basic idea is that a hexagon is just a truncated triangle, and so by adjusting how much you truncate you can morph smoothly between the two. Plus some spinning.Here's the code: smootherstep[t_] := 6 t^5 - 15 t^4 + 10 t^3; smootheststep[t_] := -20 t^7 + 70 t^6 - 84 t^5 + 35 t^4; NgonToNOver2Gon[n_, r_, center_, ?_, t_] := DeleteDuplicates[Table[center + ReIm[r Exp[I (? + 2 ? /n (i + (-1)^i *t/2))]], {i, 0, n - 1}]]; DynamicModule[{t}, Manipulate[ t = smootheststep[1 - Abs[1 - s]]; Graphics[{CapForm["Round"], FaceForm[None], EdgeForm[Directive[JoinForm["Round"], Thickness[.008]]], Table[{EdgeForm[Blend[{ColorData["BrightBands"][i/5], White}, t]], Polygon[ NgonToNOver2Gon[6,1 - t/2, (2 - 3/2 t) ReIm[Exp[I*2 ?/6 (i + 6 (2 smootheststep[Mod[s/2 + 1/2, 1]] - 1))]], ?/6 (1 + 2 i + 4 smootheststep[Mod[s, 1]] + 12 (2 smootherstep[Mod[s/2 + 1/2, 1]] - 1)), t]]}, {i, 0, 5}]}, PlotRange -> 4, ImageSize -> 540, Background -> GrayLevel[.15]], {s, 0, 2}] ]