Message Boards Message Boards

[GIF] Derange (Deforming a plain weave)

GROUPS:

Deforming a plain weave

Derange

I always find weaving patterns a challenge, since the way my brain wants to think of them (as a collection of long strands passing over and under other long strands) doesn't usually match with what I can easily make Mathematica do (since there's no consistent way of layering the strands).

In any case, when I saw this, it was more obvious than usual how to recreate it fairly easily (using short strands). Once I'd done that, I just played around until I got an animation I liked.

Here's the (slightly ugly) code:

DynamicModule[{f, cols, angle},
 f = π Piecewise[{{0, # < 0}, {1/2 - 1/2 Cos[#], 0 <= # < π}, {1, # >= π}}] &;
 cols = RGBColor /@ {"#EEEEEE", "#00ADB5", "#303841"};
 Manipulate[
  Graphics[
   {Thickness[.02],
    Table[{angle = f[(θ - π (i + j + 10)/20)];
      Blend[cols[[{1, 2, 1}]], angle/π],
      Line[({i, j} + RotationMatrix[angle].#) & /@ {{-.7, 0}, {.7, 0}}],
      Line[({i + 1, j} + RotationMatrix[angle].#) & /@ {{0, -.7}, {0, .7}}]},
     {i, -4, 4, 2}, {j, -4, 4, 2}],
    Table[{angle = f[(θ - π (i + j + 10)/20)];
      Blend[cols[[{1, 2, 1}]], angle/π],
      Line[({i, j} + RotationMatrix[-angle].#) & /@ {{-.7, 0}, {.7, 0}}],
      Line[({i + 1, j} + RotationMatrix[-angle].#) & /@ {{0, -.7}, {0, .7}}]},
     {i, -5, 5, 2}, {j, -5, 5, 2}]},
   PlotRange -> 4.75, ImageSize -> 540, Background -> cols[[3]]],
  {θ, 0, 2 π}]
 ]
POSTED BY: Clayton Shonkwiler
Answer
1 year ago

I really enjoy this, thanks a lot for sharing! This is a sort of dynamic transition between order and chaos, a wave of disorder rolling and passing. The change of color emphasizes the contrast.

POSTED BY: Marina Shchitova
Answer
1 year ago

@Marina Shchitova Thanks! That's definitely what I was going for.

POSTED BY: Clayton Shonkwiler
Answer
1 year ago

enter image description here - another post of yours has been selected for the Staff Picks group, congratulations !

We are happy to see you at the tops of the "Featured Contributor" board. Thank you for your wonderful contributions, and please keep them coming!

POSTED BY: Moderation Team
Answer
1 year ago

Not sure if you are following Wolfram social media, but these from time to time are appearing there, very nice!

https://www.facebook.com/wolframresearch/posts/10153689401698795

https://twitter.com/WolframResearch/status/715259835655163905

POSTED BY: Vitaliy Kaurov
Answer
1 year ago

@Vitaliy Kaurov Very cool. Thanks for letting me know!

POSTED BY: Clayton Shonkwiler
Answer
1 year ago

Group Abstract Group Abstract