simvx.core.animation.blend_space

Blend spaces for multi-clip animation blending.

Module Contents

Classes

BlendSpace1D

Blends between animation clips along a single parameter axis.

BlendSpace2D

Blends between animation clips positioned in 2D parameter space.

API

class simvx.core.animation.blend_space.BlendSpace1D[source]

Blends between animation clips along a single parameter axis.

Each clip is placed at a numeric position on the axis. When the parameter is set, the two nearest clips are blended proportionally.

Example: bs = BlendSpace1D() bs.add_point(idle_clip, 0.0) bs.add_point(walk_clip, 0.5) bs.add_point(run_clip, 1.0)

bs.set_parameter(0.75)           # blend walk+run
value = bs.sample("speed", 0.5)  # sample at t=0.5 in blended clips

Initialization

add_point(clip: simvx.core.animation.track.AnimationClip, position: float) None[source]

Register a clip at a position on the blend axis.

set_parameter(value: float) None[source]

Set the current blend parameter value.

property parameter: float
sample(property_path: str, time: float) Any[source]

Sample a property at time with the current blend parameter.

Returns the blended value by evaluating the two nearest clips.

sample_all(time: float) dict[str, Any][source]

Sample all properties at time using the current blend parameter.

class simvx.core.animation.blend_space.BlendSpace2D[source]

Blends between animation clips positioned in 2D parameter space.

Uses inverse-distance weighted interpolation across all points for robustness (falls back to exact match when the parameter lands directly on a point).

Example: bs = BlendSpace2D() bs.add_point(idle_clip, (0.0, 0.0)) bs.add_point(walk_fwd_clip, (0.0, 1.0)) bs.add_point(strafe_r_clip, (1.0, 0.0))

bs.set_parameter(0.5, 0.5)
value = bs.sample("position", 0.5)

Initialization

add_point(clip: simvx.core.animation.track.AnimationClip, position: tuple[float, float]) None[source]

Register a clip at a 2D position.

set_parameter(x: float, y: float) None[source]

Set the current 2D blend parameter.

sample(property_path: str, time: float) Any[source]

Sample a single property with the current 2D blend parameter.

sample_all(time: float) dict[str, Any][source]

Sample all properties with the current 2D blend parameter.