ProteinMotion
Reference navigation
On this page

Unthread

Reverse Thread, pulling actual molecular geometry out of view along curved paths.

python
from proteinmotion import Unthread

Constructor

python
Unthread(
    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 to take out of view.
cameraNoneScene camera for departure past the frame edges.
modekeyword only'geometry'"3d" draws lines within the model; "2d" draws lines over the image.
aspectkeyword onlyNoneImage width divided by height.
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 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.
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

Takes the same options as Thread; the motion is its exact reverse, so with stagger the last chain leaves first.

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
targetsproperty · inherited from ThreadObjects whose state this animation changes.
bind()method · inherited from ThreadCapture starting values when the scene schedules the animation.
apply()method · inherited from ThreadEvaluate the animation at eased progress alpha. Called by the timeline.
during()method · inherited from AnimationSet this animation duration and start delay in seconds.

Inherited from thread.Thread.

python
Unthread.targets

Objects whose state this animation changes.

Inherited from thread.Thread.

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

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