Created
May 2, 2020 02:50
-
-
Save matthen/e144d781bf30b0ac87e9cdcf2b130282 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
smoothstep[t_, t0_, t1_] := | |
With[{tt = (t - t0)/(t1 - t0)}, | |
If[tt < 0, 0, If[tt > 1, 1, 6 tt^5 - 15 tt^4 + 10 tt^3]]]; | |
a = 0.918; | |
p = ShearingMatrix[a, {1, 0}, {0, 1}].{Cos[th], Sin[th]}; \[Theta] = | |
ArcTan @@ Reverse[(p /. NMaximize[Norm[p], th][[2]])]; | |
yscale = (RotationMatrix[\[Theta]].(p /. {th -> \[Theta]}))[[2]]; | |
xscale = (RotationMatrix[\[Theta]].(p /. {th -> \[Theta] - | |
Pi/2}))[[1]]; | |
\[Theta]2 = ArcTan @@ ((ScalingTransform[{(1/xscale) , (1/yscale) }]. | |
RotationTransform[\[Theta]]. | |
ShearingTransform[a, {1, 0}, {0, 1}])[{1, 0}]); | |
frame[t_, t2_, t3_, t4_] := ( | |
Graphics[{ | |
GeometricTransformation[ | |
{ | |
White, | |
Table[ | |
{Line[{{-4, v}, {4, v}}], Line[{{v, -4}, {v, 4}}]}, | |
{v, -4, 4, 0.5}], | |
EdgeForm[Directive[Thickness[0.008], White]], | |
Opacity[0.5], RGBColor[0.35, 0.79, 1.], | |
Disk[{0, 0}, {0.618, 1}] | |
}, | |
RotationTransform[-\[Theta]2 smoothstep[t4, 0, 1]]. | |
ScalingTransform[{(1/xscale) smoothstep[t3, 0, 1] + (1 - | |
smoothstep[t3, 0, 1]), (1/yscale) smoothstep[t3, 0, | |
1] + (1 - smoothstep[t3, 0, 1])}]. | |
RotationTransform[\[Theta] smoothstep[t2, 0, 1]]. | |
ShearingTransform[a smoothstep[t, 0, 1], {1, 0}, {0, 1}] | |
] | |
}, | |
PlotRange -> 2, | |
Axes -> None, | |
Background -> Black | |
] | |
); | |
Manipulate[ | |
frame[t, t2, t3, t4], | |
{{t, 1}, 0, 1}, | |
{{t2, 1}, 0, 1}, | |
{{t3, 1}, 0, 1}, | |
{t4, 0, 1} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment