AnimationComponent Class
Namespace: Stride.EngineAssembly: Stride.Engine.dll
[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
Remarks
Data is stored as in http://altdevblogaday.com/2011/10/23/low-level-animation-part-2/.
Name | Description | |
---|---|---|
Constructors | ||
AnimationComponent() | ||
Properties | ||
Animations | Gets the animations associated to the component. |
|
Blender | ||
BlendTreeBuilder | ||
PlayingAnimations | Gets list of active animations. Use this to customize startup animations. |
|
Methods | ||
Add(AnimationClip, Double, AnimationBlendOperation, Single, Single, Nullable<AnimationRepeatMode>) | Adds a new playing animation at the end of the list. It doesn't alter currently playing animations. |
|
Blend(String, Single, TimeSpan) | Blends progressively a new animation. |
|
Crossfade(String, TimeSpan) | Crossfades to a new animation. |
|
Ended(PlayingAnimation) | Returns an awaitable object that will be completed when the animation is removed from the PlayingAnimation list. This happens when:
|
|
IsPlaying(String) | Returns |
|
NewPlayingAnimation(String) | ||
Play(String) | Plays right away the animation with the specified name, instantly removing all other blended animations. |
Constructors
AnimationComponent()
public AnimationComponent()
Properties
Animations
Gets the animations associated to the component.
public Dictionary<string, AnimationClip> Animations { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, AnimationClip> |
Blender
public AnimationBlender Blender { get; }
Property Value
Type | Description |
---|---|
AnimationBlender |
BlendTreeBuilder
public IBlendTreeBuilder BlendTreeBuilder { get; set; }
Property Value
Type | Description |
---|---|
IBlendTreeBuilder |
PlayingAnimations
Gets list of active animations. Use this to customize startup animations.
public TrackingCollection<PlayingAnimation> PlayingAnimations { get; }
Property Value
Type | Description |
---|---|
TrackingCollection<PlayingAnimation> |
Methods
Add(AnimationClip, Double, AnimationBlendOperation, Single, Single, Nullable<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 = 1F, float weight = 1F, AnimationRepeatMode? repeatMode = null)
Parameters
Type | Name | Description |
---|---|---|
AnimationClip | clip | Animation clip to add to the list of playing animations |
System.Double | startTime | Time, in seconds, at which the animation starts playing |
AnimationBlendOperation | blend | Blend mode - linear or additive |
System.Single | timeScale | Speed at which the animation should play |
System.Single | weight | Weight of the animation, in regard to all other playing animations. |
System.Nullable<AnimationRepeatMode> | repeatMode | Repeat mode - play once or loop indefinitely |
Returns
Type | Description |
---|---|
PlayingAnimation | The added playing animation |
Blend(String, Single, TimeSpan)
Blends progressively a new animation.
public PlayingAnimation Blend(string name, float desiredWeight, TimeSpan fadeTimeSpan)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.Single | desiredWeight | The desired weight. |
System.TimeSpan | fadeTimeSpan | The fade time span. |
Returns
Type | Description |
---|---|
PlayingAnimation |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | name |
Crossfade(String, TimeSpan)
Crossfades to a new animation.
public PlayingAnimation Crossfade(string name, TimeSpan fadeTimeSpan)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
System.TimeSpan | fadeTimeSpan | The fade time span. |
Returns
Type | Description |
---|---|
PlayingAnimation |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | name |
Ended(PlayingAnimation)
Returns an awaitable object that will be completed when the animation is removed from the PlayingAnimation list. 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
public Task Ended(PlayingAnimation animation)
Parameters
Type | Name | Description |
---|---|---|
PlayingAnimation | animation |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
IsPlaying(String)
Returns true
if the specified animation is in the list of currently playing animations
public bool IsPlaying(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the animation to check |
Returns
Type | Description |
---|---|
System.Boolean |
|
NewPlayingAnimation(String)
public PlayingAnimation NewPlayingAnimation(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Returns
Type | Description |
---|---|
PlayingAnimation |
Play(String)
Plays right away the animation with the specified name, instantly removing all other blended animations.
public PlayingAnimation Play(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The animation name. |
Returns
Type | Description |
---|---|
PlayingAnimation |