Skip to content

hertzforge.animation

animation

A geometry's animation exported as one page that plays offline (hertzforge export-animation).

The animation is the one the app's 3-D view plays for the same selection (service.show): a shape set's modes on their geometry, or data played on it, measured motion or modal coordinates through their shape set (summed in the page, as the app sums them). The page is the report viewer (report/viewer.html) with the animation in place of a report, so it is drawn by the app's own 3-D view with its own controls, needs no service, and can be shown in an iframe.

Classes:

Name Description
AnimationError

An animation that cannot be exported, in words for the person exporting it.

Functions:

Name Description
opening_camera

The camera an animation opens with, as a shape3d view's home ({'eye', 'up'}): eye

amplitude_unit

The deflection an amplitude of 1 draws in a shape3d view, in its units: AMP_UNIT of

frame_box

The box a view is framed on: around the drawn points (rows of x, y, z, as drawn) whose

staged

view opening at opacity (1 solid, down to above 0) and from camera (opening_camera;

framed

The box view (animation_view of geometry) is framed on for the element groups of

animation_view

The shape3d view the app shows for geometry with data and/or shapes (with

animation_page

The animation as one self-contained HTML page: it opens playing, at mode mode (from 1)

export_animation

The animation written to output as one page (animation_page, which takes

Classes

AnimationError

Bases: RuntimeError

An animation that cannot be exported, in words for the person exporting it.

Functions:

opening_camera

opening_camera(view: str = 'iso', eye: Sequence[float] | None = None, up: Sequence[float] | None = None) -> dict[str, list[float]] | None

The camera an animation opens with, as a shape3d view's home ({'eye', 'up'}): eye and up (Z when not given) when eye is given, else the named view's from VIEWS. None for 'iso', which keeps the geometry's own view.

amplitude_unit

amplitude_unit(view: dict[str, Any]) -> float

The deflection an amplitude of 1 draws in a shape3d view, in its units: AMP_UNIT of the diagonal across its nodes, point layers and segment layers, the whole model's whatever the view is framed on; AMP_UNIT when nothing has an extent. The protocol states the rule (schema/PROTOCOL.md, shape3d), and the shell draws by it.

frame_box

frame_box(geometry: Any, groups: Sequence[str], points: Any, ids: Any) -> dict[str, list[float]]

The box a view is framed on: around the drawn points (rows of x, y, z, as drawn) whose node ids (ids, one per leading row of points) the elements of groups use, as {'lo', 'hi'}. ValueError for an empty list, a name that is not one of geometry's element groups, or groups none of whose nodes are drawn.

staged

staged(view: dict[str, Any], opacity: float = 1.0, camera: dict[str, list[float]] | None = None, frame: dict[str, list[float]] | None = None) -> dict[str, Any]

view opening at opacity (1 solid, down to above 0) and from camera (opening_camera; its own when None), fitted to frame (frame_box) when given rather than to the whole model.

framed

framed(project: Any, geometry: str, view: dict[str, Any], groups: Sequence[str] | None) -> dict[str, list[float]] | None

The box view (animation_view of geometry) is framed on for the element groups of geometry (frame_box), None when no groups are given; AnimationError saying why not.

animation_view

animation_view(project: Any, geometry: str, data: str | None = None, shapes: str | None = None, records: Sequence[int] = (), coloring: dict[str, Any] | None = None) -> dict[str, Any]

The shape3d view the app shows for geometry with data and/or shapes (with records of data picked when given), or AnimationError saying why there is none. With coloring (service.show.element_coloring), an element shape set's elements are colored by their strain or stress as the model moves: the modal coordinates data played through their shape set, or with no data the set's own modes, as the app's Play Strain and Stress and Color By draw them.

animation_page

animation_page(project: Any, geometry: str, data: str | None = None, shapes: str | None = None, records: Sequence[int] = (), mode: int = 1, scale: float = 1.0, opacity: float = 1.0, view: str = 'iso', eye: Sequence[float] | None = None, up: Sequence[float] | None = None, frame: Sequence[str] | None = None, theme: str | None = None, title: str | None = None) -> str

The animation as one self-contained HTML page: it opens playing, at mode mode (from 1) when there is no motion, at scale times the app's amplitude, the surface at opacity, looking from the named view or from eye with up (opening_camera), framed on the element groups frame of the geometry when given (the whole model still drawn, and the amplitude still a share of the whole model's size), in the light or dark theme (the reader's own when None), titled title (the view's own when None).

export_animation

export_animation(project: Any, output: str | Path, geometry: str, data: str | None = None, shapes: str | None = None, **options: Any) -> Path

The animation written to output as one page (animation_page, which takes options); the path written.