8
$\begingroup$

This question already has an answer here:

How can I animate the following curve?

ParametricPlot3D[
  {Cos[Sqrt[2] t](3 + Cos[t]), Sin[Sqrt[2] t] (3 + Cos[t]), Sin[t]},
  {t, 0, 50}
]

Can I also remove the coordinate box?

$\endgroup$

marked as duplicate by Öskå, MarcoB, Alex Trounev, Edmund, Carl Lange Jun 28 at 10:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

8
$\begingroup$

I would use Manipulate as it is just like Animate but more flexible.

enter image description here

Manipulate[
 Module[{t},
  ParametricPlot3D[{Cos[Sqrt[2] t] (3 + Cos[t]), 
    Sin[Sqrt[2] t] (3 + Cos[t]), Sin[t]},
   {t, 0, maxTime},
   ImageSize -> 300,
   PlotRange -> {{-4, 4}, {-4, 4}, {-1, 1}},
   PlotStyle -> Red]
  ]
 ,
 {{maxTime, 1, "time"}, 1, 50, 0.01, Appearance -> "Labeled"},
 TrackedSymbols :> {maxTime}
 ]

To removed the box and the axis, look at options Boxed -> False and Axes -> False

In Manipulate, you decide which are the control variables in your expression. For each one, you add a control variable definition in the body of the Manipulate. In this case, there is only one control variable.

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thanks. Can I run the time automatically? $\endgroup$ – user21210 Jun 16 at 5:52
  • $\begingroup$ @AbdelRahmanAl-Amrat Yes. Open the Manipulate control (click on the small + thing on the right side of the slider) and click on the > button to play it. $\endgroup$ – Nasser Jun 16 at 5:57
2
$\begingroup$
Animate[ParametricPlot3D[{Cos[Sqrt[2]t], Sin[Sqrt[2]t] (3 + Cos[t]), Sin[t]}, {t, 0, tmax},
   PlotRangePadding -> Scaled[.1], 
   PlotRange -> {{-1.1, 1.1}, {-2 Pi, 2 Pi}, {-1.1, 1.1}}] /. 
    Line -> ({CapForm[None], FaceForm[Opacity[.5, Blue], Yellow], Tube[#, .1]} &), 
 {tmax, 1, 50, .01}, 
 AnimationRunning -> False]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks again kglr! $\endgroup$ – user21210 Jun 16 at 6:02
  • $\begingroup$ @AbdelRahman, you are welcome. $\endgroup$ – kglr Jun 16 at 6:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.