Last active
August 28, 2019 02:14
-
-
Save taroyabuki/98d5e34ea996382adb9d 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
roll = 10; | |
surface[s_, t_] := | |
RotationMatrix[s, {0, 0, 1}].{3 + t Cos[t]/(roll Pi), 0, t Sin[t]/(roll Pi)} | |
donut[t_] := | |
ParametricPlot3D[surface[s, u], {s, 0, 2 Pi}, {u, 0, t}, | |
Axes -> False, Boxed -> False, Mesh -> None, PlotPoints -> 40] | |
bugs[t_, n_] := | |
Graphics3D[{PointSize[0.03], | |
Point[Table[surface[s, t], {s, 0, 2 Pi (1 - 1/n), 2 Pi/n}]]}, | |
Boxed -> False] | |
f = 100; | |
frames = ParallelTable[ | |
Show[donut[t], bugs[t, 50], | |
PlotRange -> {{-4, 4}, {-4, 4}, {-1, 1}}], {t, 0.001, roll Pi, roll Pi/f}]; | |
ListAnimate[Reverse[frames]] | |
Export["2019-08-14-donut.gif", Reverse[frames], | |
AnimationRepetitions -> Infinity, "DisplayDurations" -> 1/10] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment