Message Boards Message Boards

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

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}]
 ]

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: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract