Animation#
- class ansys.tools.visualization_interface.backends.pyvista.animation.Animation(plotter: pyvista.Plotter, frames: FrameSequence | List[Any], fps: int = 30, loop: bool = False, scalar_bar_args: dict | None = None, **plot_kwargs)#
Animation controller for PyVista visualizations.
This class manages animation playback, providing play/pause/stop controls, frame stepping, timeline scrubbing, and export capabilities.
- Parameters:
- plotter
pv.Plotter PyVista plotter instance to animate.
- frames
FrameSequenceorList[Any] Frame sequence or list of frame objects to animate.
- fps
int,optional Frames per second for playback (default: 30).
- loopbool,
optional Whether to loop animation continuously (default: False).
- scalar_bar_args
dict,optional Scalar bar and rendering arguments to apply. Supports: -
clim: tuple - Fixed color scale (min, max) for all frames -title: str - Scalar bar title -color: str - Scalar bar text color - Other parameters accepted by PyVista’sadd_meshmethod
- plotter
Examples
Create and play a simple animation:
>>> from ansys.tools.visualization_interface import Plotter >>> plotter = Plotter(backend='pyvista') >>> frames = [mesh1, mesh2, mesh3] >>> animation = plotter.animate(frames, fps=30, loop=True) >>> animation.play()
Overview#
Start or resume animation playback. |
|
Pause animation playback. |
|
Stop animation and reset to first frame. |
|
Advance one frame forward. |
|
Rewind one frame backward. |
|
Jump to specific frame. |
|
Export animation to video file. |
|
Display animation with the plotter. |
Current animation state. |
|
Current frame index. |
|
Total number of frames. |
|
Frames per second. |
Import detail#
from ansys.tools.visualization_interface.backends.pyvista.animation import Animation
Property detail#
- property Animation.state: AnimationState#
Current animation state.
Method detail#
- Animation.play()#
Start or resume animation playback.
- Animation.pause()#
Pause animation playback.
- Animation.stop()#
Stop animation and reset to first frame.
- Animation.step_forward()#
Advance one frame forward.
- Animation.step_backward()#
Rewind one frame backward.
- Animation.seek(frame_index: int)#
Jump to specific frame.
- Parameters:
- frame_index
int Target frame index.
- frame_index