Message Boards Message Boards

[GIF] Unfold (Octagon to 16-gon transition)

GROUPS:

Octagon to 16-gon transition

Unfold

A fairly simple little thing, linearly interpolating between a double-covered octagon and a regular 16-gon.

Here's the code:

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

DynamicModule[{n = 16, s, 
  cols = RGBColor /@ {"#03C1EB", "#86F3B8", "#e5e7de", "#482D57"}},
 Manipulate[
  s = (-1)^Floor[t];
  Graphics[
   {cols[[Floor[t/2] + 1]],
    Polygon[
     smootheststep[Abs[1 - Mod[t, 2]]]
       Table[{Cos[θ], Sin[θ]}, {θ, s π/2, 4 π + s π/2, 4 π/n}]
      + (1 - smootheststep[Abs[1 - Mod[t, 2]]]) 
       Table[{Cos[θ], Sin[θ]}, {θ, -s π/2, 2 π - s π/2, 2 π/n}]]},
   PlotRange -> Sqrt[2], ImageSize -> 540, Background -> cols[[-1]]],
  {t, 0, 4}]
 ]
POSTED BY: Clayton Shonkwiler
Answer
3 months ago

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming!

POSTED BY: Moderation Team
Answer
3 months ago

Group Abstract Group Abstract