ProteinMotion
Reference navigation
On this page

Thread

Thread the actual cartoon or atoms and bonds into view with eased travel over the full clip.

python
from proteinmotion import Thread

Constructor

python
Thread(
    protein,
    camera=None,
    *,
    mode='geometry',
    aspect=None,
    radius=0.45,
    settle=None,
    swirl=1.0,
    head=None,
    glow=12.0,
    glow_color=None,
    glow_brightness=1.0,
    easing=None,
    stagger=0.0,
    resolution=None,
    seed=0,
    rate_func=None,
    delay_seconds=None,
    stagger_fraction=None,
    wire_options=None,
)

Parameters

ParameterDefaultDescription
proteinRequiredProtein with at least one traced chain. Cartoon, ribbon and ball-and-stick are supported; surface raises ValueError.
cameraNoneScene camera for off-screen entry; None uses a starting distance based on the molecule size.
modekeyword only'geometry'geometry transports the current representation; wire retains the original wire-and-crossfade effect.
aspectkeyword onlyNoneScene width divided by height for entry positioning; defaults to 16/9.
radiuskeyword only0.453D line cylinder radius in ångströms.
settlekeyword onlyNoneFinal fraction of the clip for the wire-to-protein crossfade. Applies only to wire mode.
swirlkeyword only1.0Strength of the corkscrew around each flight path; 0 gives smooth arcs.
headkeyword onlyNoneRadius of the wire's tip, as a multiple of the wire radius.
glowkeyword only12.0Halo radius around each leading terminus, as a multiple of radius; 0 turns the glow off.
glow_colorkeyword onlyNoneHalo color; None blends each chain's color with warm white.
glow_brightnesskeyword only1.0Halo intensity multiplier.
easingkeyword onlyNoneTravel easing returning a value in [0, 1]. None selects quintic smooth for geometry or ease_in_out_sine for wire mode.
staggerkeyword only0.0Delay between chains, as a fraction of the threading time, in chain order.
resolutionkeyword onlyNoneSpacing in Å between wire points.
seedkeyword only0Integer that varies the flight paths.
rate_funckeyword onlyNoneCallable that maps progress in [0, 1] to a finite value in [0, 1].
delay_secondskeyword onlyNoneDelay between successive residue, chain, or glyph starts, in seconds. Choose one delay option.
stagger_fractionkeyword onlyNoneTotal clip fraction reserved for staggered starts, in [0, 1).
wire_optionskeyword onlyNoneLegacy wire-only settings: settle, head, resolution. Requires mode=wire.

Notes

Geometry follows a route through the C terminus toward the N terminus. Residues and ligands move as rigid groups; inter-residue bonds may stretch. Final coordinates restore exactly. Flight paths illustrate an entrance, not physical folding. Do not combine with concurrent coordinate or representation animations. Mode wire preserves the original crossfade effect.

Example and output

Run this command from a repository checkout.

Code Render command
bash
proteinmotion render examples/thread_hemoglobin.py ThreadHemoglobin \
  --fps 60 -o hemoglobin.mp4
Output Preview · 23.1 s · 60 fps
Hemoglobin, one chain at a time

Four wires fly in from four sides and thread the α and β subunits of human deoxyhemoglobin from their C termini, one after another. The cartoon and the four hemes then fade in, and the wires pull back out.

Methods and properties

NameDescription
targetspropertyObjects whose state this animation changes.
bind()methodCapture starting values when the scene schedules the animation.
apply()methodEvaluate the animation at eased progress alpha. Called by the timeline.
during()method · inherited from AnimationSet this animation duration and start delay in seconds.
python
Thread.targets

Objects whose state this animation changes.

python
Thread.bind()

Capture starting values when the scene schedules the animation.

Returns: None

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

python
Thread.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
Thread.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.