spine_set_keyframes
Add or replace keyframes on a Spine animation timeline, creating the animation if missing. Supports bone, slot, constraint, event and drawOrder keys with customizable curves and upsert, append or replace modes.
Instructions
Add or replace keyframes of one timeline (the animation is created if missing).
Timelines and their key fields (written in the Spine 4.x JSON format):
rotate (bone) keys: {"time": 0, "value": 15} ("angle" is accepted too)
translate (bone) keys: {"time": 0, "x": 10, "y": -4}
scale (bone) keys: {"time": 0, "x": 1, "y": 1}
shear (bone) keys: {"time": 0, "x": 0, "y": 0}
translatex/translatey/scalex/scaley/shearx/sheary (bone) keys: {"time": 0, "value": 3}
inherit (bone) keys: {"time": 0, "inherit": "noScale"}
attachment(slot) keys: {"time": 0, "name": "eyes-closed"} (null clears)
rgba / rgb (slot) keys: {"time": 0, "color": "FFFFFFFF"} (RRGGBB for rgb)
rgba2 / rgb2 (slot) keys: {"time": 0, "light": "FFFFFFFF", "dark": "000000"}
alpha (slot) keys: {"time": 0, "value": 0.5}
event keys: {"time": 0.2, "name": "footstep", "int": 1}
drawOrder keys: {"time": 0, "offsets": [{"slot": "arm", "offset": 1}]}
ik (constraint) keys: {"time": 0, "mix": 1, "softness": 0, "bendPositive": false}
transform (constraint) keys: {"time": 0, "mixRotate": 1, "mixX": 0.5, ...} (mixRotate/mixX/mixY/mixScaleX/mixScaleY/mixShearY; omitted mixes keep the setup value)
path.position / path.spacing (constraint) keys: {"time": 0, "value": 0.25}
path.mix (constraint) keys: {"time": 0, "mixRotate": 1, "mixX": 1, "mixY": 1}
physics.inertia/strength/damping/mass/wind/gravity/mix keys: {"time": 0, "value": 30}
physics.reset keys: {"time": 0.5} (physics target "" = every physics constraint)
Curves: every key accepts "curve": "linear" (default), "stepped", a preset
("ease", "ease-in", "ease-out", "ease-in-out", "smooth") or [cx1, cy1, cx2, cy2]
normalized to the interval up to the next key (0..1, like CSS cubic-bezier).
They are converted to Spine's absolute bezier values automatically and keep their
shape when keys are added later. The curve argument is the default for keys
that do not specify one.
Args: target: Bone name for bone timelines, slot name for slot timelines, constraint name for ik/transform/path/physics. Ignored for event/drawOrder. mode: upsert (default: merge, new keys win at equal times), append (merge, error on equal times) or replace (the whole timeline).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keys | Yes | ||
| mode | No | upsert | |
| curve | No | ||
| target | No | ||
| project | Yes | ||
| timeline | Yes | ||
| animation | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |