ProteinMotion
Reference navigation
On this page

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,
    easing=None,
    delay_seconds=None,
)

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].
easingkeyword onlyNoneNamed easing (smooth, linear, ease_in_out_sine, there_and_back) or callable mapping [0, 1] to [0, 1]. Per-item easing preserves stagger timing.
delay_secondskeyword onlyNoneDelay between successive residue, chain, or glyph starts, in seconds. Choose one delay option.

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 WriteCapture starting values when the scene schedules the animation.
during()method · inherited from AnimationSet this animation duration and start delay in seconds.
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 annotations.Write.

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.during(seconds, *, delay=0)

Set this animation duration and start delay in seconds.

ParameterDefaultDescription
secondsRequiredPositive animation duration in seconds.
delaykeyword only0Nonnegative animation start delay in seconds.

Inherited from animation.Animation.

python
Unwrite.targets

Objects whose state this animation changes.