ProteinMotion
Reference navigation
On this page

CLASS · v0.9.1

FadeIn

Fade a protein or annotation from transparent to its current opacity.

python
from proteinmotion import FadeIn

Constructor

python
FadeIn(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

Set the desired final opacity before creating the animation. For atom or residue selections, use SetOpacity.

Example and output

This excerpt runs inside a scene’s construct() method. The full example file includes imports, structure loading, and camera setup. Run it from a repository checkout.

Code Scene excerpt
python
p = ubiquitin()
frame(self, p)
self.play(FadeIn(p), run_time=1)
self.play(Rotate(p, np.pi), run_time=3)
self.play(Representation(p, "ribbon"), run_time=1)
self.play(
    p.animate.shift((5, 0, 0)),
    self.camera.animate.orbit(theta=0.6),
    run_time=2,
)
self.wait(0.5)
Output Preview · 7.5 s · 60 fps
Rotation and movement

Ubiquitin, PDB 1UBQ.

Methods and properties

NameDescription
bind()methodCapture starting values when the scene schedules the animation.
apply()methodEvaluate the animation at eased progress alpha. Called by the timeline.
targetsproperty · inherited from AnimationObjects whose state this animation changes.
python
FadeIn.bind()

Capture starting values when the scene schedules the animation.

Returns: None

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

python
FadeIn.apply(alpha)

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

ParameterDefaultDescription
alphaRequiredEased animation progress in [0, 1].

Returns: None

Inherited from animation.Animation.

python
FadeIn.targets

Objects whose state this animation changes.