Docs/Format/Animation

Overview

MeshCraft supports keyframe animations via named actions. Each action contains channels, and each channel animates one scalar property of one named object over time using keyframes.

Complete Example

<actions>
  <action name="Bounce" duration="2.0" loop="true">
    <channel target="BouncingBox" property="position.y">
      <keyframe time="0.0" value="0.0" interp="cubic">
        <handle_left  dt="-0.2" dv="0.0"/>
        <handle_right dt=" 0.2" dv="2.0"/>
      </keyframe>
      <keyframe time="1.0" value="3.0" interp="cubic">
        <handle_left  dt="-0.2" dv="2.0"/>
        <handle_right dt=" 0.2" dv="-2.0"/>
      </keyframe>
      <keyframe time="2.0" value="0.0" interp="linear"/>
    </channel>
  </action>

  <action name="Spin" duration="3.0" loop="true">
    <channel target="SpinningSphere" property="rotation.y">
      <keyframe time="0.0"  value="0.0"   interp="linear"/>
      <keyframe time="3.0"  value="360.0" interp="linear"/>
    </channel>
  </action>

  <action name="Flash" duration="2.0" loop="true">
    <channel target="FadingPlane" property="visible">
      <keyframe time="0.0" value="1.0" interp="step"/>
      <keyframe time="0.5" value="0.0" interp="step"/>
      <keyframe time="1.0" value="1.0" interp="step"/>
    </channel>
  </action>
</actions>

action attributes

AttributeTypeDefaultDescription
namestringUnique clip name
durationfloat1.0Clip length in seconds
loopbooleanfalseLoop when end is reached

channel attributes

AttributeDescription
targetName of the scene object (Mc3Object.name) to animate.
propertyWhich property to animate (see table below).

keyframe attributes

AttributeTypeDescription
timefloatTime in seconds (keyframes sorted ascending on load)
valuefloatProperty value at this time
interplinear|step|cubicInterpolation to the next keyframe

For interp="cubic", optional child elements specify tangent handles (offsets from the keyframe's (time, value)):

<handle_left  dt="-0.2" dv="0.0"/>   <!-- in-tangent -->
<handle_right dt=" 0.2" dv="1.5"/>   <!-- out-tangent -->

Animatable Properties

Property nameUnitglTF export
position.x/y/zworld unitstranslation VEC3
rotation.x/y/zdegreesquaternion VEC4
scale.x/y/zfactorscale VEC3
visible0=false, ≥0.5=truenot exported
deform.x/y/zfactornot exported
material.baseColor.r/g/b/a0–1not exported
material.roughness0–1not exported
material.metallic0–1not exported
material.emissive.r/g/b0–1not exported

glTF Export Notes