[GIF] Stepper (Two tessellations)

Posted 2 years ago
2230 Views
|
|
4 Total Likes
|
 StepperThis is obviously the same basic idea as Reinvention, but with eight spokes rather than six.Two possibly confusing definitions in the following code: The quantity $r$ defines the length of the spokes, which varies between $1$ and $\sec(\pi/8) \approx 1.08239$. The latter is the length needed to make sure spokes connect in the quadrilaterals-and-octagons configuration, but leads to unpleasant visual artifacts if it isn't decreased to $1$ when switching configurations. The function $f(x)$ is $1$ minus $e^{-7x/16}\left[ \cos\left(\frac{3\sqrt{23}}{16}x\right) + \frac{1}{2} \sin \left(\frac{3\sqrt{23}}{16}x\right)\right]$, which is a solution of the (under-)damped harmonic oscillator equation $y'' + \frac{7}{8}y' +y=0$. Anyway, here's the code: DynamicModule[{n = 8, cols, f, t, r}, cols = RGBColor /@ {"#08D9D6", "#FF2E63", "#252A34"}; f[x_] := 1 - E^(-7 x/16) Cos[(3 Sqrt[23] x)/16] - 1/2 E^(-7 x/16) Sin[(3 Sqrt[23] x)/16]; Manipulate[ t = π/8 f[s] + π/8 f[Clip[s - 20, {0, 20}]]; r = (1 - f[s] + f[Clip[s - 20, {0, 20}]]) (1 - Sec[π/8]) + Sec[π/8]; Graphics[{Thickness[.01], CapForm["Round"], Table[Line[{x, 2 y + (-1)^x/2} + # & /@ {{0, 0}, r {Cos[θ + (-1)^x t], Sin[θ + (-1)^x t]}}, VertexColors -> {cols[[1]], Blend[Join[#, #] &[cols[[;; 2]]], 1/3 f[s] + 1/3 f[Clip[s - 20, {0, 20}]]]}], {x, -3, 3}, {y, -3.25, 2.75}, {θ, 0, 2 π - 2 π/n, 2 π/n}]}, PlotRange -> 3, ImageSize -> 540, Background -> cols[[3]]], {s, 0, 40}] ]