-
Notifications
You must be signed in to change notification settings - Fork 0
SpriteFrames
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.SpriteFrames |
| Namespace | Electron2D |
| Kind | class |
| Category | Animation and Tweening |
Stores named texture-frame animations for Electron2D.AnimatedSprite2D.
public sealed class Electron2D.SpriteFrames : Electron2D.ResourceA Electron2D.SpriteFrames resource owns animation names, frame textures,
relative frame durations, playback speeds and loop modes. The resource does
not run playback by itself; Electron2D.AnimatedSprite2D consumes it during
scene processing.
A new instance always contains an empty animation named default.
This type is not synchronized. Mutate it during loading or on the main scene thread. Read-only access is safe from another thread only when no thread is mutating the resource.
This type is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2DElectron2D.Texture2D
| Member | Kind | Summary |
|---|---|---|
Electron2D.SpriteFrames() |
Constructor | Creates a new sprite-frame library with an empty default animation. |
AddAnimation(Electron2D.StringName) |
Method | Adds an empty animation. |
AddFrame(Electron2D.StringName, Electron2D.Texture2D, System.Single, System.Int32) |
Method | Adds a frame to an animation. |
Clear(Electron2D.StringName) |
Method | Removes all frames from one animation. |
ClearAll() |
Method | Removes all animations and recreates an empty default animation. |
DuplicateAnimation(Electron2D.StringName, Electron2D.StringName) |
Method | Duplicates an animation into a new animation name. |
GetAnimationLoop(Electron2D.StringName) |
Method | Gets whether an animation uses linear looping. |
GetAnimationLoopMode(Electron2D.StringName) |
Method | Gets the loop mode for an animation. |
GetAnimationNames() |
Method | Gets animation names in deterministic alphabetical order. |
GetAnimationSpeed(Electron2D.StringName) |
Method | Gets the speed of an animation in frames per second. |
GetFrameCount(Electron2D.StringName) |
Method | Gets the number of frames in an animation. |
GetFrameDuration(Electron2D.StringName, System.Int32) |
Method | Gets a frame's relative duration. |
GetFrameTexture(Electron2D.StringName, System.Int32) |
Method | Gets a frame's texture. |
HasAnimation(Electron2D.StringName) |
Method | Checks whether an animation exists. |
RemoveAnimation(Electron2D.StringName) |
Method | Removes an animation. |
RemoveFrame(Electron2D.StringName, System.Int32) |
Method | Removes one frame from an animation. |
RenameAnimation(Electron2D.StringName, Electron2D.StringName) |
Method | Renames an animation. |
SetAnimationLoop(Electron2D.StringName, System.Boolean) |
Method | Sets whether an animation uses linear looping. |
SetAnimationLoopMode(Electron2D.StringName, Electron2D.SpriteFrames.LoopModeEnum) |
Method | Sets the loop mode for an animation. |
SetAnimationSpeed(Electron2D.StringName, System.Single) |
Method | Sets the speed of an animation in frames per second. |
SetFrame(Electron2D.StringName, System.Int32, Electron2D.Texture2D, System.Single) |
Method | Replaces one frame in an animation. |
Kind: Constructor
public Electron2D.SpriteFrames()Creates a new sprite-frame library with an empty default
animation.
The default animation uses linear looping and a speed of five frames per second.
Construction is safe on any thread when the instance is not shared until after construction completes.
This constructor is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames
Kind: Method
public System.Void AddAnimation(Electron2D.StringName)(Electron2D.StringName animation)Adds an empty animation.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The non-empty animation name to add.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.InvalidOperationException: Thrown when an animation with the same name already exists.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.HasAnimation(Electron2D.StringName)Electron2D.SpriteFrames.RemoveAnimation(Electron2D.StringName)
Kind: Method
public System.Void AddFrame(Electron2D.StringName, Electron2D.Texture2D, System.Single, System.Int32)(Electron2D.StringName animation, Electron2D.Texture2D texture, System.Single duration, System.Int32 atPosition)Adds a frame to an animation.
The absolute frame duration in seconds is calculated by
Electron2D.AnimatedSprite2D from the relative duration, animation
speed and playing speed.
-
animation: The animation that receives the frame. -
texture: The texture to display for the frame. -
duration: The positive relative frame duration. -
atPosition: The insertion index, or-1to append the frame.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.ArgumentNullException: Thrown whentextureisnull. -
System.ArgumentOutOfRangeException: Thrown whendurationis not finite or not greater than zero, or whenatPositionis outside the valid insertion range. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.GetFrameTexture(Electron2D.StringName,System.Int32)Electron2D.SpriteFrames.SetFrame(Electron2D.StringName,System.Int32,Electron2D.Texture2D,System.Single)
Kind: Method
public System.Void Clear(Electron2D.StringName)(Electron2D.StringName animation)Removes all frames from one animation.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation to clear.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.ClearAll
Kind: Method
public System.Void ClearAll()()Removes all animations and recreates an empty default animation.
This keeps the resource in a valid state for nodes whose
Electron2D.AnimatedSprite2D.Animation is still set to
default.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.Clear(Electron2D.StringName)
Kind: Method
public System.Void DuplicateAnimation(Electron2D.StringName, Electron2D.StringName)(Electron2D.StringName animationFrom, Electron2D.StringName animationTo)Duplicates an animation into a new animation name.
This method follows the validation and lifetime rules of its declaring type.
-
animationFrom: The existing animation to copy. -
animationTo: The new animation name.
-
System.ArgumentException: Thrown when either animation name is empty. -
System.InvalidOperationException: Thrown whenanimationFromdoes not exist oranimationToalready exists.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.RenameAnimation(Electron2D.StringName,Electron2D.StringName)
Kind: Method
public System.Boolean GetAnimationLoop(Electron2D.StringName)(Electron2D.StringName animation)Gets whether an animation uses linear looping.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation name.
true when Electron2D.SpriteFrames.GetAnimationLoopMode(Electron2D.StringName) returns
Electron2D.SpriteFrames.LoopModeEnum.Linear; otherwise, false.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is safe to call from any thread when no thread is mutating the resource.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.GetAnimationLoopMode(Electron2D.StringName)Electron2D.SpriteFrames.SetAnimationLoop(Electron2D.StringName,System.Boolean)
Kind: Method
public Electron2D.SpriteFrames.LoopModeEnum GetAnimationLoopMode(Electron2D.StringName)(Electron2D.StringName animation)Gets the loop mode for an animation.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation name.
The loop mode assigned to the animation.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is safe to call from any thread when no thread is mutating the resource.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.SetAnimationLoopMode(Electron2D.StringName,Electron2D.SpriteFrames.LoopModeEnum)
Kind: Method
public Electron2D.StringName[] GetAnimationNames()()Gets animation names in deterministic alphabetical order.
This method follows the validation and lifetime rules of its declaring type.
An array containing all animation names.
This method is safe to call from any thread when no thread is mutating the resource.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.AddAnimation(Electron2D.StringName)
Kind: Method
public System.Single GetAnimationSpeed(Electron2D.StringName)(Electron2D.StringName animation)Gets the speed of an animation in frames per second.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation name.
The animation speed in frames per second.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is safe to call from any thread when no thread is mutating the resource.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.SetAnimationSpeed(Electron2D.StringName,System.Single)
Kind: Method
public System.Int32 GetFrameCount(Electron2D.StringName)(Electron2D.StringName animation)Gets the number of frames in an animation.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation name.
The frame count for the animation.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is safe to call from any thread when no thread is mutating the resource.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.AddFrame(Electron2D.StringName,Electron2D.Texture2D,System.Single,System.Int32)
Kind: Method
public System.Single GetFrameDuration(Electron2D.StringName, System.Int32)(Electron2D.StringName animation, System.Int32 index)Gets a frame's relative duration.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation name. -
index: The zero-based frame index.
The positive relative frame duration.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.ArgumentOutOfRangeException: Thrown whenindexis outside the animation frame range. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is safe to call from any thread when no thread is mutating the resource.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.SetFrame(Electron2D.StringName,System.Int32,Electron2D.Texture2D,System.Single)
Kind: Method
public Electron2D.Texture2D GetFrameTexture(Electron2D.StringName, System.Int32)(Electron2D.StringName animation, System.Int32 index)Gets a frame's texture.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation name. -
index: The zero-based frame index.
The texture assigned to the frame.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.ArgumentOutOfRangeException: Thrown whenindexis outside the animation frame range. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is safe to call from any thread when no thread is mutating the resource.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.AddFrame(Electron2D.StringName,Electron2D.Texture2D,System.Single,System.Int32)
Kind: Method
public System.Boolean HasAnimation(Electron2D.StringName)(Electron2D.StringName animation)Checks whether an animation exists.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation name to check.
true when the resource contains animation;
otherwise, false.
This method is safe to call from any thread when no thread is mutating the resource.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.AddAnimation(Electron2D.StringName)
Kind: Method
public System.Void RemoveAnimation(Electron2D.StringName)(Electron2D.StringName animation)Removes an animation.
Removing the final animation recreates an empty default
animation.
-
animation: The animation to remove.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.AddAnimation(Electron2D.StringName)
Kind: Method
public System.Void RemoveFrame(Electron2D.StringName, System.Int32)(Electron2D.StringName animation, System.Int32 index)Removes one frame from an animation.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation that owns the frame. -
index: The zero-based frame index to remove.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.ArgumentOutOfRangeException: Thrown whenindexis outside the animation frame range. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.AddFrame(Electron2D.StringName,Electron2D.Texture2D,System.Single,System.Int32)
Kind: Method
public System.Void RenameAnimation(Electron2D.StringName, Electron2D.StringName)(Electron2D.StringName animation, Electron2D.StringName newName)Renames an animation.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The existing animation name. -
newName: The new animation name.
-
System.ArgumentException: Thrown when either animation name is empty. -
System.InvalidOperationException: Thrown whenanimationdoes not exist ornewNamealready exists.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.DuplicateAnimation(Electron2D.StringName,Electron2D.StringName)
Kind: Method
public System.Void SetAnimationLoop(Electron2D.StringName, System.Boolean)(Electron2D.StringName animation, System.Boolean loop)Sets whether an animation uses linear looping.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation name. -
loop:trueto setElectron2D.SpriteFrames.LoopModeEnum.Linear;falseto setElectron2D.SpriteFrames.LoopModeEnum.None.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.GetAnimationLoop(Electron2D.StringName)Electron2D.SpriteFrames.SetAnimationLoopMode(Electron2D.StringName,Electron2D.SpriteFrames.LoopModeEnum)
Kind: Method
public System.Void SetAnimationLoopMode(Electron2D.StringName, Electron2D.SpriteFrames.LoopModeEnum)(Electron2D.StringName animation, Electron2D.SpriteFrames.LoopModeEnum loopMode)Sets the loop mode for an animation.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation name. -
loopMode: The loop mode to assign.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.GetAnimationLoopMode(Electron2D.StringName)
Kind: Method
public System.Void SetAnimationSpeed(Electron2D.StringName, System.Single)(Electron2D.StringName animation, System.Single fps)Sets the speed of an animation in frames per second.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation name. -
fps: The positive finite speed in frames per second.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.ArgumentOutOfRangeException: Thrown whenfpsis not finite or not greater than zero. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.GetAnimationSpeed(Electron2D.StringName)
Kind: Method
public System.Void SetFrame(Electron2D.StringName, System.Int32, Electron2D.Texture2D, System.Single)(Electron2D.StringName animation, System.Int32 index, Electron2D.Texture2D texture, System.Single duration)Replaces one frame in an animation.
This method follows the validation and lifetime rules of its declaring type.
-
animation: The animation that owns the frame. -
index: The zero-based frame index to replace. -
texture: The replacement texture. -
duration: The positive relative frame duration.
-
System.ArgumentException: Thrown whenanimationis empty. -
System.ArgumentNullException: Thrown whentextureisnull. -
System.ArgumentOutOfRangeException: Thrown whenindexis outside the animation frame range, or whendurationis not finite or not greater than zero. -
System.InvalidOperationException: Thrown whenanimationdoes not exist.
This method is not synchronized. Mutate the resource on one thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.SpriteFrames.GetFrameDuration(Electron2D.StringName,System.Int32)Electron2D.SpriteFrames.GetFrameTexture(Electron2D.StringName,System.Int32)
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.