Table of Contents

Class AnimationMetaData

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

Animation Meta Data is a json type that controls how an animation should be played.

public class AnimationMetaData
Inheritance
AnimationMetaData

Examples

"animations": [
	{
		"code": "hurt",
		"animation": "hurt",
		"animationSpeed": 2.2,
		"weight": 10,
		"blendMode": "AddAverage"
	},
	{
		"code": "die",
		"animation": "death",
		"animationSpeed": 1.25,
		"weight": 10,
		"blendMode": "Average",
		"triggeredBy": { "onControls": [ "dead" ] }
	},
	{
		"code": "idle",
		"animation": "idle",
		"blendMode": "AddAverage",
		"easeOutSpeed": 4,
		"triggeredBy": { "defaultAnim": true }
	},
	{
		"code": "walk",
		"animation": "walk",
		"weight": 5
	}
]

Fields

Animation (Required)

The animations code identifier that we want to play

[JsonProperty]
public string Animation

Field Value

string

AnimationSound

[JsonProperty]
public AnimationSound AnimationSound

Field Value

AnimationSound

Code (Required)

Unique identifier to be able to reference this AnimationMetaData instance

[JsonProperty]
public string Code

Field Value

string

AnimationSpeed (Optional) (Default: 1)

The speed this animation should play at.

[JsonProperty]
public float AnimationSpeed

Field Value

float

Attributes (Optional) (Default: None)

Custom attributes that can be used for the animation. Valid vanilla attributes are:

  • damageAtFrame (float)
  • soundAtFrame (float)
  • authorative (bool)
[JsonProperty]
[JsonConverter(typeof(JsonAttributesConverter))]
public JsonObject Attributes

Field Value

JsonObject

BlendMode (Optional) (Default: Add)

The animation blend mode. Controls how this animation will react with other concurrent animations. Also see ElementBlendMode to control blend mode per element.

[JsonProperty]
public EnumAnimationBlendMode BlendMode

Field Value

EnumAnimationBlendMode

ClientSide (Optional) (Default: false)

If true, the server does not sync this animation.

[JsonProperty]
public bool ClientSide

Field Value

bool

EaseInSpeed (Optional) (Default: 10)

A multiplier applied to the weight value to "ease in" the animation. Choose a high value for looping animations or it will be glitchy

[JsonProperty]
public float EaseInSpeed

Field Value

float

EaseOutSpeed (Optional) (Default: 10)

A multiplier applied to the weight value to "ease out" the animation. Choose a high value for looping animations or it will be glitchy

[JsonProperty]
public float EaseOutSpeed

Field Value

float

ElementBlendMode (Optional) (Default: None)

A way of specifying BlendMode per element.

[JsonProperty]
public Dictionary<string, EnumAnimationBlendMode> ElementBlendMode

Field Value

Dictionary<string, EnumAnimationBlendMode>

ElementWeight (Optional) (Default: None)

A way of specifying Weight for each element. Also see ElementBlendMode to control blend modes per element..

[JsonProperty]
public Dictionary<string, float> ElementWeight

Field Value

Dictionary<string, float>

HoldEyePosAfterEasein (Optional) (Default: 99)

A value that determines whether to change the first-person eye position for the camera. Higher values will keep eye position static.

[JsonProperty]
public float HoldEyePosAfterEasein

Field Value

float

MulWithWalkSpeed (Optional) (Default: false)

Should this animation speed be multiplied by the movement speed of the entity?

[JsonProperty]
public bool MulWithWalkSpeed

Field Value

bool

SupressDefaultAnimation (Optional) (Default: false)

Should this animation stop default animations from playing?

[JsonProperty]
public bool SupressDefaultAnimation

Field Value

bool

TriggeredBy (Optional) (Default: None)

Controls when this animation should be played.

[JsonProperty]
public AnimationTrigger TriggeredBy

Field Value

AnimationTrigger

Weight (Optional) (Default: 1)

The weight of this animation. When using multiple animations at a time, this controls the significance of each animation. The method for determining final animation values depends on this and BlendMode.

[JsonProperty]
public float Weight

Field Value

float

WeightCapFactor (Optional) (Default: 0)

This property can be used in cases where a animation with high weight is played alongside another animation with low element weight. In these cases, the easeIn become unaturally fast. Setting a value of 0.8f or similar here addresses this issue.

  • 0f = uncapped weight
  • 0.5f = weight cannot exceed 2
  • 1f = weight cannot exceed 1
[JsonProperty]
public float WeightCapFactor

Field Value

float

WithFpVariant

[JsonProperty]
public bool WithFpVariant

Field Value

bool