ProteinMotion
Reference navigation
On this page

CLASS · v0.9.1

Unwrite

Erase glyph fills and then their outlines.

python
from proteinmotion import Unwrite

Constructor

python
Unwrite(target, *, lag_ratio=None, stroke_width=1.5, reverse=False, rate_func=linear)

Parameters

ParameterDefaultDescription
targetRequiredAnnotation to draw: Text, Callout, ResidueLabel, ResidueLabels, Distance, or InteractionHighlight.
lag_ratiokeyword onlyNoneDelay between glyph starts relative to glyph duration; None chooses a value from glyph count.
stroke_widthkeyword only1.5Glyph outline width in design pixels at 1080p.
reversekeyword onlyFalseReverse residue or glyph order.
rate_funckeyword onlylinearCallable that maps progress in [0, 1] to a finite value in [0, 1].

Notes

Uses the Write constructor. Glyphs disappear from last to first by default; reverse=True changes that order.

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
title = Text(
    "Protein motion",
    font_size=130,
    font="semibold",
    position=(0.1, 0.38),
)
self.play(
    Write(title, lag_ratio=0.12, stroke_width=1.8),
    run_time=2.5,
)
self.wait(1)
self.play(Unwrite(title), run_time=1.5)
Output Preview · 5.0 s · 60 fps
Write and Unwrite

Letter outlines are drawn, filled, and erased.

Methods and properties

NameDescription
apply()methodEvaluate the animation at eased progress alpha. Called by the timeline.
bind()method · inherited from AnimationCapture starting values when the scene schedules the animation.
targetsproperty · inherited from AnimationObjects whose state this animation changes.
python
Unwrite.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
Unwrite.bind()

Capture starting values when the scene schedules the animation.

Returns: None

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

Inherited from animation.Animation.

python
Unwrite.targets

Objects whose state this animation changes.