Table of Contents

Class AnimationComponent

Namespace
Stride.Engine
Assembly
Stride.Engine.dll

Add animation capabilities to an Entity. It will usually apply to Skeleton

[DataContract("AnimationComponent")]
[DefaultEntityComponentProcessor(typeof(AnimationProcessor), ExecutionMode = ExecutionMode.Runtime|ExecutionMode.Thumbnail|ExecutionMode.Preview)]
[Display("Animations", null, Expand = ExpandRule.Once)]
[ComponentOrder(2000)]
[ComponentCategory("Animation")]
public sealed class AnimationComponent : EntityComponent, IIdentifiable
Inheritance
AnimationComponent
Implements
Inherited Members

Remarks

Constructors

AnimationComponent()

public AnimationComponent()

Properties

Animations

Gets the animations associated to the component.

public Dictionary<string, AnimationClip> Animations { get; }

Property Value

Dictionary<string, AnimationClip>

BlendTreeBuilder

public IBlendTreeBuilder BlendTreeBuilder { get; set; }

Property Value

IBlendTreeBuilder

Blender

public AnimationBlender Blender { get; }

Property Value

AnimationBlender

PlayingAnimations

Gets list of active animations. Use this to customize startup animations.

public TrackingCollection<PlayingAnimation> PlayingAnimations { get; }

Property Value

TrackingCollection<PlayingAnimation>

Methods

Add(AnimationClip, double, AnimationBlendOperation, float, float, AnimationRepeatMode?)

Adds a new playing animation at the end of the list. It doesn't alter currently playing animations.

public PlayingAnimation Add(AnimationClip clip, double startTime = 0, AnimationBlendOperation blend = AnimationBlendOperation.LinearBlend, float timeScale = 1, float weight = 1, AnimationRepeatMode? repeatMode = null)

Parameters

clip AnimationClip

Animation clip to add to the list of playing animations

startTime double

Time, in seconds, at which the animation starts playing

blend AnimationBlendOperation

Blend mode - linear or additive

timeScale float

Speed at which the animation should play

weight float

Weight of the animation, in regard to all other playing animations.

repeatMode AnimationRepeatMode?

Repeat mode - play once or loop indefinitely

Returns

PlayingAnimation

The added playing animation

Blend(string, float, TimeSpan)

Blends progressively a new animation.

public PlayingAnimation Blend(string name, float desiredWeight, TimeSpan fadeTimeSpan)

Parameters

name string

The name.

desiredWeight float

The desired weight.

fadeTimeSpan TimeSpan

The fade time span.

Returns

PlayingAnimation

Exceptions

ArgumentException

name

Crossfade(string, TimeSpan)

Crossfades to a new animation.

public PlayingAnimation Crossfade(string name, TimeSpan fadeTimeSpan)

Parameters

name string

The name.

fadeTimeSpan TimeSpan

The fade time span.

Returns

PlayingAnimation

Exceptions

ArgumentException

name

Ended(PlayingAnimation)

Returns an awaitable object that will be completed when the animation is removed from the PlayingAnimation list.

public Task Ended(PlayingAnimation animation)

Parameters

animation PlayingAnimation

Returns

Task

Remarks

This happens when:

  • RepeatMode is PlayOnce and animation reached end
  • Animation faded out completely (due to blend to 0.0 or crossfade out)
  • Animation was manually removed from AnimationComponent.PlayingAnimations

IsPlaying(string)

Returns true if the specified animation is in the list of currently playing animations

public bool IsPlaying(string name)

Parameters

name string

The name of the animation to check

Returns

bool

true if the animation is playing, false otherwise

NewPlayingAnimation(string)

public PlayingAnimation NewPlayingAnimation(string name)

Parameters

name string

Returns

PlayingAnimation

Play(string)

Plays right away the animation with the specified name, instantly removing all other blended animations.

public PlayingAnimation Play(string name)

Parameters

name string

The animation name.

Returns

PlayingAnimation