Group Abstract Group Abstract

Message Boards Message Boards

3D rotate a MoleculePlot3D

Posted 1 month ago

I am really impressed by MoleculePlot3D, but I am wondering how to make the sort of classic "spinning molecule" GIF. The things I have tried ViewAngle and ViewCenter, but only succeed in a sort of fisheye look. I have used the following code (from documentation) as a template to no real success:

With[{obj = PolyhedronData["Icosahedron"]}, 
 Animate[Show[obj, SphericalRegion -> True, 
   ViewVector -> {5 Cos[t], 5 Sin[t], 10 Sin[t/2]}], {t, 0, 4 Pi}, 
  AnimationRunning -> False]]

Thank you for any help, I think this is a really cool area of the Wolfram Language! Forgive me if I am missing an obvious solution.

3 Replies

Probably simplest:

Tour3DVideo[MoleculePlot3D[Molecule["NC(=O)C[C@H](C(=O)O)N"],SphericalRegion->True]]
POSTED BY: Vitaliy Kaurov

Perfect! I did not know about this function - always something new to explore in Wolfram Language. Thanks Vitaliy!

Robert,

maybe this is what you are trying to achieve:

videoList = 
  With[{obj = PolyhedronData["Icosahedron"]}, 
   Table[Show[obj, SphericalRegion -> True, ViewVector -> {5 Cos[t], 5 Sin[t], 5}], {t, 0, 2 Pi, .05}]];
Export["rotmol.gif", videoList, "DisplayDurations" -> .05]
POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard