5
$\begingroup$

This is my code:

 curve = With[{c = ArcTan[a t]},
              r {Cos[t] Cos[c], Sin[t] Cos[c], -Sin[c]}]

Block[{r = 1, a = .2}, Show[{
   Graphics3D[{Opacity[.3], Sphere[{0, 0, 0}, r]}],
   ParametricPlot3D[curve, {t, -30, 30}, PlotRange -> All]}]]

How to animate a point as in the following example to move the line Helix:

Block[{r = 5, a = .6}, 
 Animate[Show[Graphics3D[{Opacity[.3], Sphere[{0, 0, 1}]}], 
   Graphics3D[{PointSize[.05], 
     Point[{Sin[v]*Sin[v], Cos[v]*Cos[v], v/10}]}], 
   ParametricPlot3D[curve, {t, -30, 30}, PlotRange -> All], 
   Axes -> True, PlotRange -> {{-1, 1}, {-1, 1}, {0, 2}}], {v, 0, 
   20}]]
$\endgroup$
1
  • $\begingroup$ Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – user9660
    Commented May 18, 2016 at 12:59

2 Answers 2

5
$\begingroup$

I always prefer to make a list of images, and use ListAnimate to animate them, rather than Animate,

curve[t_] := 
 With[{c = ArcTan[a t]}, r {Cos[t] Cos[c], Sin[t] Cos[c], -Sin[c]}]
Block[{r = 1, a = .2},
 sphere = Show[
   {Graphics3D[{Opacity[.3], Sphere[{0, 0, 0}, r]}], 
    ParametricPlot3D[curve[t], {t, -30, 30}, PlotRange -> All]}
   ];
 imglist = Table[
   Show[
    {sphere,
     Graphics3D@{Red, PointSize[Large], Sphere[curve[tt], .1]}
     }]
   , {tt, -30, 30, .1}];
 ]

ListAnimate[imglist]
$\endgroup$
1
$\begingroup$

Use the same parametric form for the point

Animate[
 Block[{r = 1, a = .2}, 
 Show[{Graphics3D[{Opacity[.3], Sphere[{0, 0, 0}, r]}], 
 ParametricPlot3D[curve, {t, -30, 30}, PlotRange -> All],
 Graphics3D[Point[curve /. t -> t0]]}]]
, {t0, -30, 30}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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