Skip to content

Animation Format

kltyton edited this page Dec 1, 2026 · 6 revisions

Animation Format (interactive_animation:interactions)

Wiki Home | 简体中文

AnimCue extends standard Bedrock / GeckoLib / PAL animation JSON files (format_version: "1.8.0") by adding a single top-level interactive_animation:interactions object. Files without interactive_animation:interactions are ignored by AnimCue.

Top-Level Structure

{
  "format_version": "1.8.0",
  "animations": {
    "<animation_name>": {
      "animation_length": 2.0,
      "bones": { ... },
      "timeline": {
        "0.25": "marker_a",
        "1.00": ["marker_b", "marker_c"]
      }
    }
  },
  "interactive_animation:interactions": {
    "<animation_name>": {
      "participants": [ ... ],
      "camera": { ... }
    }
  }
}

Validation Rules (SceneReader)

  • Every key inside interactive_animation:interactions must match an existing animation key inside animations.
  • Each scene must declare between 1 and 64 entries in participants.
  • Every participant must have a unique, non-empty role string.
  • If animation_length is present on the primary animation, no bone track, camera track, timeline marker, sound_effects keyframe, or particle_effects keyframe may exceed animation_length (tolerance 1e-5). If omitted, the scene length is computed from the last keyframe or marker timestamp.

Participants

Each object in participants supports:

Field Required Type Description
role Yes string Unique role name used by Bindings.named(...), SceneHandle, and ClientScenes.subjectFor(...).
type No string Default preview asset type: entity, item, block, or model (default: model). Case-insensitive.
id Yes string Resource identifier for the default asset (e.g. minecraft:player, minecraft:iron_sword, or a custom ID registered via ClientAssets.registerModel).
bones No object Map of bone name → channel tracks (position, rotation, scale, bend).
sound_effects No object Timed sound keyframes using the same format as primary sound_effects (dispatched with role set to the participant's role).
particle_effects No object Timed particle keyframes using the same format as primary particle_effects (dispatched with role set to the participant's role).

Live instances passed through Bindings override the default preview asset at playback time.


interactive_animation:root Whole-Actor Track

The reserved bone name interactive_animation:root drives whole-participant spatial displacement and rotation relative to the primary SceneSubject.Frame:

  • position: Model units (16 units = 1 Minecraft block), transformed by the subject's yaw.
  • rotation: Euler angles in degrees. Rotation values are not clamped to [-180, 180], so multi-turn spins (e.g. 0 → 720) retain their authored winding.
  • scale: Optional scale vector (default [1, 1, 1]).

Participants without a interactive_animation:root track still apply their skeletal bone tracks without moving their world entity position.


Bone Channels & Interpolation (BoneTrack / AnimationCurve)

Each bone entry under bones may declare any combination of four channels:

  • position (default [0, 0, 0])
  • rotation (default [0, 0, 0])
  • scale (default [1, 1, 1])
  • bend (default [0, 0, 0], used for limb/torso bend adapters such as PAL More Rotation or legacy bend bridges)

Keyframe Formats

Each channel accepts:

  • A static 3-element numeric array [x, y, z] or scalar number (expanded to [v, v, v]),
  • A single keyframe object with pre / post, or
  • A timestamp map ("0.0", "0.25", ...) where every timestamp is a finite non-negative number in seconds.

Individual keyframes support discontinuous pre / post values and lerp_mode:

"left_leg": {
  "rotation": {
    "0.0": [-30, 0, 0],
    "0.25": {
      "post": [28, 0, 0],
      "lerp_mode": "catmullrom"
    },
    "0.5": [-30, 0, 0]
  },
  "bend": {
    "0.0": [18, 0, 0],
    "0.25": {
      "post": [64, 0, 0],
      "lerp_mode": "catmullrom"
    },
    "0.5": [18, 0, 0]
  }
}

Supported lerp_mode values:

  • "linear" (default): linear interpolation between previous.post and next.pre.
  • "catmullrom": Catmull-Rom cubic spline interpolation across neighboring keyframes.

Curve components accept finite numbers or MoLang string expressions (pure numeric curves automatically take a zero-allocation constant fast path).

MoLang Support & Ecosystem Bridges

AnimCue ships a built-in zero-dependency MoLang engine (degree-based Bedrock math.*, PAL MochaMathExtensions easing curves, 75+ standard q.* / query.* entity & world queries, per-scene persistent v.* / variable.*, local t.* / temp.*, c.* / context.*, ??, ?:, logical/comparison operators, ;, and return), usable in:

  • Transform curves: bone position, rotation, scale, bend (including 3-axis PAL More Rotation), interactive_animation:root, and camera ([x, y, z], "vector", "pre", "post").
  • IK weights: ik[].weight as a MoLang string or timestamped MoLang curve.
  • Timeline scripts: timeline strings containing assignments/expressions (e.g. "v.charge = (v.charge ?? 0) + 1;") execute automatically on the scene's MolangVariableStore while still firing marker listeners; plain marker labels (e.g. "hit_window") remain unaffected.
  • Branch & State Machine conditions: branches[].condition and state_machine.states.<name>.transitions[].condition accept MoLang boolean expressions directly (e.g. "v.charge >= 2 && q.health > 5") alongside registered Java predicates.
  • Sound & Particle keyframes: sound_effects (volume, pitch, condition, pre_effect_script) and particle_effects (count, speed, offset, condition, pre_effect_script).

When optional animation runtimes are installed, AnimCue automatically enables zero-reflection MoLang soft bridges (while keeping AnimCue's actor-scoped built-in queries authoritative for standard queries):

  • GeckoLib 4 & 5: reads custom mod-registered query.* / variable.* (with active GeoRenderState scoped on GeckoLib 5).
  • Kltyton Bedrock Runtime (KBR): resolves custom KBR MolangQueries, client-synced has_target / is_in_love via IMolangEntityState, and bidirectionally syncs actor v.* variables.
  • Player Animation Library (PAL 1.1/1.2 + Extensions): invokes MolangEvent.MOLANG_EVENT so custom PAL extension queries work automatically alongside PAL More Rotation 3-axis bend expressions.
  • SimpleBedrockModel (SBM v1 & v2): covers all MolangEntityContext / MolangLivingContext queries natively and supports optional SbmMolangBridge.bindContext(entity, sbmContext) for custom @QueryBindings and MutableObjectBinding variable sync.
  • Public SPI: register custom queries, math functions, or bridges via MolangRegistry.registerQuery(...), registerQueryFunction(...), registerMathFunction(...), and registerBridge(...), or read/write live scene variables via SceneHandle#setVariable / getVariable.

Camera Track

An optional camera object may be placed alongside participants using the same channel structure (position and rotation in Bedrock coordinates/degrees):

"interactive_animation:interactions": {
  "animation.example.intro": {
    "participants": [ ... ],
    "camera": {
      "position": { "0.0": [0, 28, -48], "1.5": [16, 24, -40] },
      "rotation": { "0.0": [12, 0, 0], "1.5": [8, -20, 0] }
    }
  }
}

When PlaybackOptions.CameraMode.AUTO is selected, AnimCue drives the camera from this track when present, or falls back to smooth follow camera for participating players.


Timeline, Sound, and Particle Keyframes

The primary animation's timeline map fires PlaybackOptions.Marker callbacks at the corresponding playback timestamp. Each timestamp may contain either a single string instruction or an array of string instructions:

"timeline": {
  "0.16": "door_open",
  "0.85": ["settle", "mount"]
}

Standard Bedrock / GeckoLib sound_effects and particle_effects keyframes are also supported on both the primary animation and individual entries in participants (accepting an object, array, or plain effect ID string per timestamp):

"sound_effects": {
  "0.25": {
    "effect": "minecraft:entity.experience_orb.pickup",
    "locator": "mouth"
  },
  "0.80": "minecraft:block.anvil.land"
},
"particle_effects": {
  "0.40": {
    "effect": "minecraft:crit",
    "locator": "right_hand",
    "pre_effect_script": "slash"
  }
}

By default, registered sound events and simple particle types play automatically at the owner's position for participant tracks and non-native primary tracks (nativePlayback = false), while native controllers (such as GeckoLib via GeckoSubjects) keep owning primary sound/particle keyframes to avoid duplicate firing. When Kltyton Bedrock Runtime (kltyton_bedrock_runtime, Lite or full) is installed alongside AnimCue, default particle keyframes also automatically dispatch KBR particle_definitions/*.json billboard and 3D model particles with pre_effect_script / script MoLang initialization expressions.


Adaptive Extensions (Optional & Backward-Compatible)

Alongside participants and camera, scenes may optionally declare:

  • anchors: Named dynamic target anchors resolving live client bone world transforms (Tier 1) with deterministic body-proportion / AABB fallback (Tier 2) on both server and client. Supports role, bone, offset (model pixels), semantic / fallback (feet, waist, chest, front_chest, back, neck, head, eye, left_shoulder, right_shoulder, left_hand, right_hand, weapon_grip, weapon_tip, mount_seat), clearance, margin, and ground_snap.
  • motion_warping (per participant): Time-windowed root-motion warping (hybrid_approach, skew_additive, scale_root_motion) with axis mask (xyz, xz, y), arc-length weighting (no foot sliding during static beats), warp_yaw, max_distance, and collision (ignore, slide, abort_blocked).
  • ik (per participant): Post-animation inverse kinematics (two_bone, aim, fabrik) driven by scalar weight curves and dynamic anchors. Single-bone humanoid limbs automatically upgrade to virtual two-bone bend IK when PAL / PlayerAnimator + bendy-lib is installed, and gracefully fall back to aim + bounded shoulder reach on pure vanilla models.
  • branches: Runtime conditional branching (trigger: marker, window, end) with priority ordering, seamless control-lease continuity, and crossfade (blend_seconds).
  • blend: Smooth in and out transitions (linear, smoothstep, cubic_in_out, ease_out_quad) supporting tail_fade and non-blocking post_release blend-out.
  • match: Dynamic scene matching metadata (sector, distance, elevation_delta, target_height, scale_ratio, target_entities, require_environment / forbid_environment, min_ceiling_clearance, priority, weight).
  • state_machine: Multi-state graph with once / looping states (max_loops, max_duration), qte_windows (single_press, hold_duration, mash_count), and transitions supporting push_stack / pop_stack interrupt sub-states.
  • sockets & props: 6DoF named sockets (also referenced via anchors.<id>.socket) and scene-owned virtual props capable of smooth socket-to-socket transfers.
  • Extended motion_warping: Multi-stage sync_points, align_to_slope pitch alignment, and collision: "detour" local obstacle steering.

Clone this wiki locally