Message Boards Message Boards

GROUPS:

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

Posted 7 months ago
1088 Views
|
1 Reply
|
3 Total Likes
|

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!

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