Skip to content

AnimationLibrary

Eduard Gushchin edited this page Jun 21, 2026 · 5 revisions

AnimationLibrary

Back to API Reference

Namespace: Electron2D

Summary

Stores named Electron2D.Animation resources for Electron2D.AnimationPlayer.

Declaration

public sealed class Electron2D.AnimationLibrary : Electron2D.Resource

Remarks

An Electron2D.AnimationLibrary groups animations under stable names. The library does not play animations by itself; it is mounted into an Electron2D.AnimationPlayer under a library name.

The library emits user signals named animation_added, animation_removed and animation_renamed when its contents change.

Thread Safety

This type is not synchronized. Mutate it during loading or on the main scene thread. Read-only access is safe only when no thread is mutating the library.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Animation
  • Electron2D.AnimationPlayer

Members

Member Kind Summary
Electron2D.AnimationLibrary() Constructor Creates an empty animation library.
AddAnimation(Electron2D.StringName, Electron2D.Animation) Method Adds an animation under a name.
GetAnimation(Electron2D.StringName) Method Gets an animation by name.
GetAnimationList() Method Gets animation names in deterministic alphabetical order.
HasAnimation(Electron2D.StringName) Method Checks whether the library contains an animation.
RemoveAnimation(Electron2D.StringName) Method Removes an animation by name.
RenameAnimation(Electron2D.StringName, Electron2D.StringName) Method Renames an existing animation.

Member Details

Electron2D.AnimationLibrary()

Kind: Constructor

public Electron2D.AnimationLibrary()

Summary

Creates an empty animation library.

Remarks

The instance starts without animations. Add entries with Electron2D.AnimationLibrary.AddAnimation(Electron2D.StringName,Electron2D.Animation).

Thread Safety

Construction is safe on any thread when the instance is not shared until construction completes.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.AnimationLibrary

AddAnimation(Electron2D.StringName, Electron2D.Animation)

Kind: Method

public Electron2D.Error AddAnimation(Electron2D.StringName, Electron2D.Animation)(Electron2D.StringName name, Electron2D.Animation animation)

Summary

Adds an animation under a name.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • name: The non-empty animation name.
  • animation: The animation resource to add.

Returns

Electron2D.Error.Ok on success, Electron2D.Error.InvalidParameter for an empty name or null animation, or Electron2D.Error.AlreadyExists when the name is already used.

Thread Safety

This method is not synchronized. Mutate the library from one thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.AnimationLibrary.HasAnimation(Electron2D.StringName)
  • Electron2D.AnimationLibrary.RemoveAnimation(Electron2D.StringName)

GetAnimation(Electron2D.StringName)

Kind: Method

public Electron2D.Animation GetAnimation(Electron2D.StringName)(Electron2D.StringName name)

Summary

Gets an animation by name.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • name: The animation name to look up.

Returns

The animation resource when found; otherwise, null.

Thread Safety

This method is safe when no thread is mutating the library.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.AnimationLibrary.HasAnimation(Electron2D.StringName)

GetAnimationList()

Kind: Method

public Electron2D.StringName[] GetAnimationList()()

Summary

Gets animation names in deterministic alphabetical order.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Returns

An array containing all animation names.

Thread Safety

This method is safe when no thread is mutating the library.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.AnimationLibrary.AddAnimation(Electron2D.StringName,Electron2D.Animation)

HasAnimation(Electron2D.StringName)

Kind: Method

public System.Boolean HasAnimation(Electron2D.StringName)(Electron2D.StringName name)

Summary

Checks whether the library contains an animation.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • name: The animation name to look up.

Returns

true when the name exists; otherwise, false.

Thread Safety

This method is safe when no thread is mutating the library.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.AnimationLibrary.GetAnimation(Electron2D.StringName)

RemoveAnimation(Electron2D.StringName)

Kind: Method

public System.Void RemoveAnimation(Electron2D.StringName)(Electron2D.StringName name)

Summary

Removes an animation by name.

Remarks

Removing a missing name is a no-op.

Parameters

  • name: The animation name to remove.

Thread Safety

This method is not synchronized. Mutate the library from one thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.AnimationLibrary.AddAnimation(Electron2D.StringName,Electron2D.Animation)

RenameAnimation(Electron2D.StringName, Electron2D.StringName)

Kind: Method

public System.Void RenameAnimation(Electron2D.StringName, Electron2D.StringName)(Electron2D.StringName name, Electron2D.StringName newName)

Summary

Renames an existing animation.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Parameters

  • name: The existing animation name.
  • newName: The new non-empty animation name.

Exceptions

  • System.ArgumentException: Thrown when either name is empty.
  • System.InvalidOperationException: Thrown when name is missing or newName already exists.

Thread Safety

This method is not synchronized. Mutate the library from one thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.AnimationLibrary.GetAnimationList

Clone this wiki locally