8

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?

C. E.
  • 70,533
  • 6
  • 140
  • 264
user21210
  • 161
  • 5

2 Answers2

8

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

Nasser
  • 143,286
  • 11
  • 154
  • 359
2
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

kglr
  • 394,356
  • 18
  • 477
  • 896