9
$\begingroup$

I have an animation for a helix being drawn in 3D but I really want to have a point on there that draws the helix. I've seen similar problems on here for 2D and I tried adapting the suggestions but I wasn't able to make anything work. I think it would be really cool to see a particle moving along this path. Any help would be greatly appreciated.

My code is as follows:

 Animate[ParametricPlot3D[{Cos[t], Sin[t], t/4}, {t, 0, u}, 
  ImageSize -> Small, PlotRange -> {{-2, 2}, {-2, 2}, {0, 8}}], {u, 0,
   30}, AnimationRate -> 3]

enter image description here

$\endgroup$
3
  • 2
    $\begingroup$ You mean something like Epilog->{Point@{Cot[u],Sin[u],u/4}}? $\endgroup$
    – Lukas Lang
    Nov 2, 2019 at 21:27
  • 1
    $\begingroup$ Or this? $\endgroup$ Nov 2, 2019 at 21:33
  • $\begingroup$ This answer may help you. $\endgroup$
    – m_goldberg
    Nov 3, 2019 at 2:01

2 Answers 2

12
$\begingroup$

You can add a moving point using a combination of options MeshFunctions, Mesh, and Method as follows:

Animate[ParametricPlot3D[{Cos[t], Sin[t], t/4}, {t, 0, u},
      ImageSize -> Small, 
      MeshFunctions -> {#4 &}, 
      Mesh -> {{u}}, 
      MeshStyle -> Red, 
      Method -> {"BoundaryOffset" -> False}, 
      PlotRange -> {{-2, 2}, {-2, 2}, {0, 8}}] /. Point -> (Sphere[#, .15] &), 
   {u, 10^-6, 30}, AnimationRate -> 3]

enter image description here\

Note: Used ReplaceAll to change the Point primitive to Sphere.

$\endgroup$
1
  • 1
    $\begingroup$ Awesome! Thank you so much!! $\endgroup$ Nov 3, 2019 at 2:34
2
$\begingroup$

Another option suitable for convenient embedding of many graphics primitives is to use Show and Graphics3D:

Animate[Module[{a}, 
  Show[
    ParametricPlot3D[a = {Cos[t], Sin[t], t/4}, {t, 0, u}, 
      ImageSize -> Small, 
      PlotRange -> {{-2, 2}, {-2, 2}, {0, 8}}], 

    Graphics3D[{Red, Sphere[a, 0.15]}]]],

 {u, 10.^-6, 30}, AnimationRate -> 3]

enter image description here

$\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.