ProteinMotion
Reference navigation
On this page

CLASS · v0.9.1

Annotation

Base class for text and lines drawn over the image.

python
from proteinmotion.annotations import Annotation

Constructor

python
Annotation()

Notes

Image positions use normalized coordinates. Opacity ranges from 0 to 1. Subclasses supply geometry through layout().

Methods and properties

NameDescription
set_opacity()methodSet or animate opacity in [0, 1].
move_to()methodSet or animate text position in normalized image coordinates.
shift()methodTranslate the object by an offset.
snapshot()methodCapture the current state for deterministic timeline evaluation.
restore()methodRestore a state produced by snapshot().
animatepropertyCreate a builder for fluent animation calls. Pass the result to scene.play().
text_progresspropertyCurrent reveal progress for glyphs and annotation lines.
python
Annotation.set_opacity(opacity)

Set or animate opacity in [0, 1].

ParameterDefaultDescription
opacityRequiredOpacity in [0, 1], from transparent to opaque.

Returns: The object or animation builder.

python
Annotation.move_to(position)

Set or animate text position in normalized image coordinates.

ParameterDefaultDescription
positionRequiredImage coordinates (x, y), with (0, 0) at the top-left and (1, 1) at the bottom-right.

Returns: The annotation or animation builder.

python
Annotation.shift(offset)

Translate the object by an offset.

ParameterDefaultDescription
offsetRequiredOffset (x, y) in design pixels at 1080p for residue labels; normalized image units for text shifts.

Returns: The object or animation builder.

python
Annotation.snapshot()

Capture the current state for deterministic timeline evaluation.

Returns: State dictionary.

python
Annotation.restore(state)

Restore a state produced by snapshot().

ParameterDefaultDescription
stateRequiredState returned by snapshot().

Returns: None

python
Annotation.animate

Create a builder for fluent animation calls. Pass the result to scene.play().

python
Annotation.text_progress

Current reveal progress for glyphs and annotation lines.