Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- torus[phiOffset_, thetaOffset_] := Module[{
- R = 10,
- r = 4,
- colors = {RGBColor[1, 1, 0.4588], RGBColor[0.8, 0.2667, 0.8549],
- RGBColor[0.2667, 0.7412, 0.8863]},
- density = 10,
- nrOfRings = 80
- },
- Show[
- ParametricPlot3D[{
- (R + r Cos[phi]) Cos[theta],
- (R + r Cos[phi]) Sin[theta],
- r Sin[phi]
- },
- {phi, 0, 2 Pi},
- {theta, 0, 2 Pi},
- Mesh -> False,
- PlotStyle -> Black
- ],
- Graphics3D[{
- Array[
- Function[ringNr,
- MapIndexed[{#,
- Point[{
- (R + (r + 0.01) Cos[
- First@#2 2 Pi/(density Length[colors]) +
- phiOffset]) Cos[ringNr 2 Pi/nrOfRings + thetaOffset],
- (R + (r + 0.01) Cos[
- First@#2 2 Pi/(density Length[colors]) +
- phiOffset]) Sin[ringNr 2 Pi/nrOfRings + thetaOffset],
- r Sin[First@#2 2 Pi/(density Length[colors]) + phiOffset]
- }]
- } &,
- RotateLeft[
- Flatten@ConstantArray[colors, density Length[colors]], ringNr]
- ]],
- nrOfRings
- ]
- }],
- Axes -> None,
- Boxed -> False,
- Background -> Black,
- ImageSize -> 500
- ]
- ]
- Array[torus[-#, #/5] &, 20, 10 Pi] // ListAnimate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement