an.ir.joints#
The constraint layer’s verbs: pin, pull, join and unjoin (ADR 0008, an#512).
A joint (an.ir.schema.JointSpec) says how two bodies stay together;
these four action kinds say what happens to them over time, and they are the
puppeteer’s whole repertoire:
pin(a rod, a nail): a point of a body is held exactly at a point (of another body, or of the stage) for a span, or refused when it is out of reach (an validatereportsunreachable_pin);pull(a string): a point is drawn as close as the joints allow toward a point, or along a path over the span, with agive;join/unjoin: a declared joint’s state from an instant on (a hand lets go of a cup; it is caught again).
None of them makes a clip. The solve compile pass (an.stage.solve)
reads them beside the joints and emits the keys of the bodies they move; the
actions pass drops them (their _SolverOnly lowering).
>>> from an.ir.compose import flatten, sequence, delay
>>> [(f.start, f.end, f.action.kind) for f in flatten(sequence(delay(1.0), pin("paul/fore_r@hand", "wheel@grip", duration=2.0)))]
[(1.0, 3.0, 'pin')]
>>> [(f.start, f.action.kind) for f in flatten(sequence(delay(1.0), unjoin("grip", at=0.5)))]
[(1.5, 'unjoin')]
These kinds are the core’s (ADR 0001’s test: a data-visualisation genre pins a
label to a bar without saying character), registered when an.ir loads.
Module Attributes
not at all. |
|
The verbs' kind names. |
Functions
|
|
|
|
|
Rejoin the joint named |
|
Let go of the joint named |
Classes
|
|
|
|
|
The declared joint named |
|
The declared joint named |
- an.ir.joints.DFLT_PULL_GIVE: float = 0.0#
not at all. A reachable point is met exactly; an unreachable one is given up for the frame before any joint of the structure is (the solver drops the last-declared joint of a conflict), so the chain reaches toward it as far as its joints allow, and nothing is torn. A positive
giveis a soft string, which yields in proportion to the masses it pulls (a compliance, px per unit of pull).- Type:
How soft a
pullis when it says nothing
- an.ir.joints.JOINT_ACTION_KINDS: tuple[str, ...] = ('pin', 'pull', 'join', 'unjoin')#
The verbs’ kind names.
- class an.ir.joints.JoinAction(*, name=None, kind='join', joint, at=0.0, **extra_data)[source]#
Bases:
ExtensionActionThe declared joint named
jointis enforced fromaton.>>> JoinAction(joint="grip", at=1.0).at 1.0
- class an.ir.joints.PinAction(*, name=None, kind='pin', point, to, duration=None, **extra_data)[source]#
Bases:
ExtensionActionpoint(body[@point]) held exactly attofordurationseconds (None: to the shot’s end). It frees the bodypointis on for the span: a pinned cup goes to the hand, wherever it was staged.>>> PinAction(point="cup", to="paul/fore_r@hand").to 'paul/fore_r@hand'
- class an.ir.joints.PullAction(*, name=None, kind='pull', point, to, over=None, give=0.0, **extra_data)[source]#
Bases:
ExtensionActionpointdrawn towardto(a point, or a path of stage points walked at an even speed over the span) foroverseconds (None: to the shot’s end), as close as the joints allow;giveis the string’s softness (compliance, px per unit of pull).>>> PullAction(point="puppet/hand_l", to=[[0, -200], [100, -200]], over=2.0).over 2.0
- class an.ir.joints.UnjoinAction(*, name=None, kind='unjoin', joint, at=0.0, **extra_data)[source]#
Bases:
ExtensionActionThe declared joint named
jointlets go fromaton.>>> UnjoinAction(joint="grip").kind 'unjoin'
- an.ir.joints.join(joint, *, at=0.0)[source]#
Rejoin the joint named
jointatat.>>> join("grip", at=2.0).at 2.0
- Return type:
- an.ir.joints.pin(point, to, *, duration=None)[source]#
pointheld atto.toisbody[@point]or(x, y).>>> pin("cup", (10.0, -40.0)).to (10.0, -40.0)
- Return type:
- an.ir.joints.pull(point, to, *, over=None, give=0.0)[source]#
pointdrawn towardto(a point, a body point, or a path).>>> pull("kite", "world@0,-300", over=1.0).give == DFLT_PULL_GIVE True
- Return type: