Message Boards Message Boards

GROUPS:

[GIF] Transition (Shifting string art)

Posted 3 years ago
1553 Views
|
0 Replies
|
4 Total Likes
|

Shifting string art

Transition

No fancy math this time. Here's what happens when you connect points on edges two apart in a regular octagon by straight lines, then let the odd-numbered vertices of the octagon go to the origin and let even-numbered vertices move away from the origin (plus various other bits of nonsense).

Code:

DynamicModule[{cols, r, u, verts},
 cols = RGBColor /@ {"#35342f", "#f1f2f0"};
 Manipulate[
  r = 1/2 - Cos[s]/2;
  u = If[s < π, s, s + 2 π];
  verts = 
   Table[(1 - r (-1)^(If[s < π, i + 1, i])) {Cos[
       2 π i/8 - u/8 - π/8], 
      Sin[2 π i/8 - u/8 - π/8]}, {i, 0, 7}];
  Graphics[{Thickness[.005], CapForm["Round"], cols[[1]], 
    Table[Line[{t verts[[i]] + (1 - t) RotateRight[verts][[i]], 
       t RotateLeft[verts][[i]] + (1 - t) RotateLeft[verts, 
           2][[i]]}], {i, 1, 7, 2}, {t, 0, 1, 1/8}]}, PlotRange -> 3, 
   ImageSize -> 540, Background -> cols[[2]]], {s, 0., 2 π}]]
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