Animation

WeasWidget supports animations using a list of ASE Atoms objects or an ASE Trajectory.

Example: Rotating a Molecule

[1]:
from ase.build import molecule
from weas_widget import WeasWidget
atoms = molecule("C2H6SO")
# create a list of atoms by rotating it.
images = []
for i in range(0, 360, 10):
    new_atoms = atoms.copy()
    new_atoms.rotate("z", i)
    images.append(new_atoms)
viewer = WeasWidget()
viewer.from_ase(images)
viewer
[1]:

Animation Controls

Timeline Interaction

  • You can play the animation using the timeline bar.

  • In play mode, only atomic positions are updated, preventing unnecessary re-drawing of bonds and polyhedra.

  • In pause mode, behavior depends on the continuous_update setting.

Continuous Update Behavior

You can toggle this setting as follows:

viewer.avr.continuous_update = False
  • Enabled (default):

    • The entire visualization (bonds, image atoms, polyhedra) updates dynamically as the user drags the timeline slider.

    • This provides real-time feedback but may be computationally expensive for large systems.

  • Disabled:

    • The model updates only when the user releases the timeline slider.

    • This reduces rendering overhead and improves performance for large animations.