-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]? - Animate does not appear to work #793
Comments
You are adding each structure as an individual model. You need to add them as frames. Concat all the xyz files together and pass the string to |
Lemme give this a try! |
Amazing! This works like a charm: import py3Dmol as p3d
# Convert all structures to XYZ strings
xyz_strings = [structure.to_xyz() for structure in xtb_opt.results.structures]
xyz_total = "".join(xyz_strings)
# Create the viewer
viewer = p3d.view(width=800, height=600)
# Add all models to the viewer and set the frames for animation
viewer.addModelsAsFrames(xyz_total, "xyz")
viewer.setStyle({"stick": {}, "sphere": {"scale": 0.25}})
viewer.zoomTo()
# Set animation parameters
viewer.animate({'interval': 100, 'loop': 'forward', 'reps': 0})
# Display the viewer
viewer.show() Thanks for the quick help. Love A final question--is there a way to add a slider for the animation so I can investigate a trajectory one frame at a time instead of an automatic loop animation? Thanks! |
That's issue #790. It isn't something that belongs in the main library, but in the UI wrapper, and it hasn't been implemented yet. |
Excellent. Thanks so much for the guidance and feedback. I've build a few cool things on top of |
Describe the bug
Running
viewer.animate
does not appear to work. Am I doing something wrong?To Reproduce
Expected behavior
I would expect the image to be animated. Instead all the images are superimposed without any animation.
Screenshots
Desktop (please complete the following information):
Additional context
Thanks so much!
The text was updated successfully, but these errors were encountered: