ProteinMotion
Reference navigation
On this page

CLASS · v0.9.1

Animation

Base class for animations evaluated by the scene timeline.

python
from proteinmotion.animation import Animation

Constructor

python
Animation(target, *, rate_func=smooth)

Parameters

ParameterDefaultDescription
targetRequiredObject to animate or use as a destination. The supported object type depends on the operation.
rate_funckeyword onlysmoothCallable that maps progress in [0, 1] to a finite value in [0, 1].

Notes

Subclass Animation to define a custom animation. Declare the channels it changes, capture starting values in bind(), and implement apply(alpha). The scene rejects simultaneous writes to the same channel.

Attributes

NameDescription
channelsSet of state channels written by the animation.
targetPrimary target object.
rate_funcProgress easing callable.

Methods and properties

NameDescription
bind()methodCapture starting values when the scene schedules the animation.
targetspropertyObjects whose state this animation changes.
apply()methodEvaluate the animation at eased progress alpha. Called by the timeline.
python
Animation.bind()

Capture starting values when the scene schedules the animation.

Returns: None

Called by ProteinScene.play(). An animation instance can be bound once.

python
Animation.targets

Objects whose state this animation changes.

python
Animation.apply(alpha)

Evaluate the animation at eased progress alpha. Called by the timeline.

ParameterDefaultDescription
alphaRequiredEased animation progress in [0, 1].

Returns: None