Reference navigation
On this page
Thread
Thread the actual cartoon or atoms and bonds into view with eased travel over the full clip.
from proteinmotion import ThreadConstructor
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
| Parameter | Default | Description |
|---|---|---|
protein | Required | Protein with at least one traced chain. Cartoon, ribbon and ball-and-stick are supported; surface raises ValueError. |
camera | None | Scene 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 only | None | Scene width divided by height for entry positioning; defaults to 16/9. |
radiuskeyword only | 0.45 | 3D line cylinder radius in ångströms. |
settlekeyword only | None | Final fraction of the clip for the wire-to-protein crossfade. Applies only to wire mode. |
swirlkeyword only | 1.0 | Strength of the corkscrew around each flight path; 0 gives smooth arcs. |
headkeyword only | None | Radius of the wire's tip, as a multiple of the wire radius. |
glowkeyword only | 12.0 | Halo radius around each leading terminus, as a multiple of radius; 0 turns the glow off. |
glow_colorkeyword only | None | Halo color; None blends each chain's color with warm white. |
glow_brightnesskeyword only | 1.0 | Halo intensity multiplier. |
easingkeyword only | None | Travel easing returning a value in [0, 1]. None selects quintic smooth for geometry or ease_in_out_sine for wire mode. |
staggerkeyword only | 0.0 | Delay between chains, as a fraction of the threading time, in chain order. |
resolutionkeyword only | None | Spacing in Å between wire points. |
seedkeyword only | 0 | Integer that varies the flight paths. |
rate_funckeyword only | None | Callable that maps progress in [0, 1] to a finite value in [0, 1]. |
delay_secondskeyword only | None | Delay between successive residue, chain, or glyph starts, in seconds. Choose one delay option. |
stagger_fractionkeyword only | None | Total clip fraction reserved for staggered starts, in [0, 1). |
wire_optionskeyword only | None | Legacy 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.
proteinmotion render examples/thread_hemoglobin.py ThreadHemoglobin \
--fps 60 -o hemoglobin.mp4Four 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
| Name | Description |
|---|---|
| targetsproperty | Objects whose state this animation changes. |
| bind()method | Capture starting values when the scene schedules the animation. |
| apply()method | Evaluate the animation at eased progress alpha. Called by the timeline. |
| during()method · inherited from Animation | Set this animation duration and start delay in seconds. |
Thread.targetsObjects whose state this animation changes.
Thread.bind()Capture starting values when the scene schedules the animation.
Returns: None
Called by ProteinScene.play(). An animation instance can be bound once.
Thread.apply(alpha)Evaluate the animation at eased progress alpha. Called by the timeline.
| Parameter | Default | Description |
|---|---|---|
alpha | Required | Eased animation progress in [0, 1]. |
Returns: None
Inherited from animation.Animation.
Thread.during(seconds, *, delay=0)Set this animation duration and start delay in seconds.
| Parameter | Default | Description |
|---|---|---|
seconds | Required | Positive animation duration in seconds. |
delaykeyword only | 0 | Nonnegative animation start delay in seconds. |