-
Notifications
You must be signed in to change notification settings - Fork 0
AnimatedSprite2D
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.AnimatedSprite2D |
| Namespace | Electron2D |
| Kind | class |
| Category | Animation and Tweening |
Displays and advances a texture-frame animation from a
Electron2D.AnimatedSprite2D.SpriteFrames resource.
public class Electron2D.AnimatedSprite2D : Electron2D.Node2DProfile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: AnimatedSprite2D
Frame-based 2D animation node with SpriteFrames, autoplay, play/pause/stop, frame progress, loop handling and canvas submission of the current frame.
Electron2D.AnimatedSprite2D is a 2D canvas node for simple frame-based
animations. It reads frame textures from Electron2D.AnimatedSprite2D.SpriteFrames, updates
playback state during Electron2D.Node._Process(System.Double), and submits the current
frame to the canvas renderer.
The node does not inherit from Electron2D.Sprite2D because its public API
intentionally omits direct texture and region editing properties.
This type is not synchronized. Create and mutate nodes on the main scene thread.
This type is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.SpriteFramesElectron2D.Node2D
| Member | Kind | Summary |
|---|---|---|
Animation |
Property | Gets or sets the current animation name. |
Autoplay |
Property | Gets or sets the animation that starts automatically when the node becomes ready. |
Centered |
Property | Gets or sets whether the current frame is drawn centered on the node origin. |
FlipH |
Property | Gets or sets whether the current frame is flipped horizontally. |
FlipV |
Property | Gets or sets whether the current frame is flipped vertically. |
Frame |
Property | Gets or sets the current frame index. |
FrameProgress |
Property | Gets or sets the normalized progress through the current frame. |
Offset |
Property | Gets or sets the local drawing offset. |
SpeedScale |
Property | Gets or sets the playback speed multiplier. |
SpriteFrames |
Property | Gets or sets the sprite-frame library used by this node. |
Electron2D.AnimatedSprite2D() |
Constructor | Creates a new animated sprite node. |
GetPlayingSpeed() |
Method | Gets the current playing speed. |
GetRect() |
Method | Gets the local rectangle occupied by the current frame. |
IsPixelOpaque(Electron2D.Vector2) |
Method | Checks whether a local sprite position maps to an opaque pixel. |
IsPlaying() |
Method | Gets whether playback is active. |
Pause() |
Method | Pauses playback while preserving frame position. |
Play(Electron2D.StringName, System.Single, System.Boolean) |
Method | Starts or resumes playback. |
PlayBackwards(Electron2D.StringName) |
Method | Starts reverse playback. |
SetFrameAndProgress(System.Int32, System.Single) |
Method | Sets the current frame and progress together. |
Stop() |
Method | Stops playback and resets playback state. |
_Process(System.Double) |
Method | Advances playback during the process step. |
_Ready() |
Method | Starts autoplay when the node becomes ready. |
Kind: Property
public Electron2D.StringName Animation { get; set; }Gets or sets the current animation name.
Changing this property resets Electron2D.AnimatedSprite2D.Frame and
Electron2D.AnimatedSprite2D.FrameProgress to the beginning of the animation.
The animation name inside Electron2D.AnimatedSprite2D.SpriteFrames. The default is
default.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean)
Kind: Property
public System.String Autoplay { get; set; }Gets or sets the animation that starts automatically when the node becomes ready.
This property follows the validation and lifetime rules of its declaring type.
The animation name to pass to Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean) from
Electron2D.Node._Ready, or an empty string to disable autoplay.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean)
Kind: Property
public System.Boolean Centered { get; set; }Gets or sets whether the current frame is drawn centered on the node origin.
This property follows the validation and lifetime rules of its declaring type.
true to center the frame; otherwise, false.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.GetRect
Kind: Property
public System.Boolean FlipH { get; set; }Gets or sets whether the current frame is flipped horizontally.
This property follows the validation and lifetime rules of its declaring type.
true to flip the frame horizontally; otherwise, false.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D
Kind: Property
public System.Boolean FlipV { get; set; }Gets or sets whether the current frame is flipped vertically.
This property follows the validation and lifetime rules of its declaring type.
true to flip the frame vertically; otherwise, false.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D
Kind: Property
public System.Int32 Frame { get; set; }Gets or sets the current frame index.
Setting this property resets Electron2D.AnimatedSprite2D.FrameProgress to
0. Use Electron2D.AnimatedSprite2D.SetFrameAndProgress(System.Int32,System.Single) to preserve a progress
value.
The zero-based frame index for Electron2D.AnimatedSprite2D.Animation.
-
System.ArgumentOutOfRangeException: Thrown when the assigned frame is negative.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.FrameProgress
Kind: Property
public System.Single FrameProgress { get; set; }Gets or sets the normalized progress through the current frame.
This property follows the validation and lifetime rules of its declaring type.
A value from 0 to 1. Forward playback moves toward
1; reverse playback moves toward 0.
-
System.ArgumentOutOfRangeException: Thrown when the assigned progress is not finite or outside0..1.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.SetFrameAndProgress(System.Int32,System.Single)
Kind: Property
public Electron2D.Vector2 Offset { get; set; }Gets or sets the local drawing offset.
This property follows the validation and lifetime rules of its declaring type.
The offset applied before the centered or top-left frame rectangle is calculated.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.GetRect
Kind: Property
public System.Single SpeedScale { get; set; }Gets or sets the playback speed multiplier.
This property follows the validation and lifetime rules of its declaring type.
The multiplier applied to the custom speed from Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean).
Negative values play in reverse. A value of 0 keeps playback
active but stops frame advancement.
-
System.ArgumentOutOfRangeException: Thrown when the assigned speed is not finite.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.GetPlayingSpeed
Kind: Property
public Electron2D.SpriteFrames SpriteFrames { get; set; }Gets or sets the sprite-frame library used by this node.
Replacing or mutating this resource affects the next process/submission pass without recreating the node.
The assigned Electron2D.AnimatedSprite2D.SpriteFrames resource, or null when
the node has no animation data.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.SpriteFrames
Kind: Constructor
public Electron2D.AnimatedSprite2D()Creates a new animated sprite node.
The node starts on the default animation, frame 0, with
playback stopped.
Construction is safe on any thread when the node is not shared until after construction completes.
This constructor is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D
Kind: Method
public System.Single GetPlayingSpeed()()Gets the current playing speed.
This method follows the validation and lifetime rules of its declaring type.
Electron2D.AnimatedSprite2D.SpeedScale multiplied by the custom speed supplied to
Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean) when playback is active; otherwise, 0.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.IsPlaying
Kind: Method
public Electron2D.Rect2 GetRect()()Gets the local rectangle occupied by the current frame.
This method follows the validation and lifetime rules of its declaring type.
The frame rectangle in local coordinates, or an empty rectangle when no frame texture is available.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D
Kind: Method
public System.Boolean IsPixelOpaque(Electron2D.Vector2)(Electron2D.Vector2 position)Checks whether a local sprite position maps to an opaque pixel.
This method follows the validation and lifetime rules of its declaring type.
-
position: The local position to query.
true if the current frame has an opaque pixel at
position; otherwise, false.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.GetRect
Kind: Method
public System.Boolean IsPlaying()()Gets whether playback is active.
This method can return true even when Electron2D.AnimatedSprite2D.SpeedScale or
the custom speed from Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean) is 0.
true when playback has been started and not paused or stopped;
otherwise, false.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.PauseElectron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean)
Kind: Method
public System.Void Pause()()Pauses playback while preserving frame position.
Calling Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean) without a new animation name resumes from the
current frame and progress.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean)Electron2D.AnimatedSprite2D.Stop
Kind: Method
public System.Void Play(Electron2D.StringName, System.Single, System.Boolean)(Electron2D.StringName name, System.Single customSpeed, System.Boolean fromEnd)Starts or resumes playback.
If the selected animation is missing or has no frames, playback remains stopped.
-
name: The animation to play, or an empty value to use the currentElectron2D.AnimatedSprite2D.Animation. -
customSpeed: The finite custom speed multiplier for this playback request. -
fromEnd:trueto begin at the last frame of the selected animation.
-
System.ArgumentOutOfRangeException: Thrown whencustomSpeedis not finite.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.PauseElectron2D.AnimatedSprite2D.PlayBackwards(Electron2D.StringName)
Kind: Method
public System.Void PlayBackwards(Electron2D.StringName)(Electron2D.StringName name)Starts reverse playback.
This method is equivalent to calling Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean) with a custom
speed of -1 and fromEnd set to true.
-
name: The animation to play backwards, or an empty value to use the currentElectron2D.AnimatedSprite2D.Animation.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean)
Kind: Method
public System.Void SetFrameAndProgress(System.Int32, System.Single)(System.Int32 frame, System.Single progress)Sets the current frame and progress together.
This method follows the validation and lifetime rules of its declaring type.
-
frame: The non-negative frame index. -
progress: The normalized progress from0to1.
-
System.ArgumentOutOfRangeException: Thrown whenframeis negative orprogressis not finite or outside0..1.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.FrameElectron2D.AnimatedSprite2D.FrameProgress
Kind: Method
public System.Void Stop()()Stops playback and resets playback state.
This resets Electron2D.AnimatedSprite2D.Frame and Electron2D.AnimatedSprite2D.FrameProgress to
0, and resets the custom speed used by Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean).
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.Pause
Kind: Method
public System.Void _Process(System.Double)(System.Double delta)Advances playback during the process step.
The current frame is advanced before the scene draw traversal submits canvas commands for the frame.
-
delta: The elapsed process time in seconds.
This callback is invoked on the main scene thread during scene-tree traversal.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.FrameElectron2D.AnimatedSprite2D.FrameProgress
Kind: Method
public System.Void _Ready()()Starts autoplay when the node becomes ready.
If Electron2D.AnimatedSprite2D.Autoplay is not empty, this callback calls
Electron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean) with that animation name after the base ready
callback has run.
This callback is invoked on the main scene thread during scene-tree traversal.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.AnimatedSprite2D.AutoplayElectron2D.AnimatedSprite2D.Play(Electron2D.StringName,System.Single,System.Boolean)
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.