Struct gdnative_bindings_lily::AnimatedTexture [−][src]
pub struct AnimatedTexture { /* fields omitted */ }
Expand description
core class AnimatedTexture
inherits Texture
(reference counted).
Official documentation
See the documentation of this class in the Godot engine’s official documentation. The method descriptions are generated from it and typically contain code samples in GDScript, not Rust.
Memory management
The lifetime of this object is automatically managed through reference counting.
Class hierarchy
AnimatedTexture inherits methods from:
Safety
All types in the Godot API have “interior mutability” in Rust parlance.
To enforce that the official thread-safety guidelines are
followed, the typestate pattern is used in the Ref
and TRef
smart pointers,
and the Instance
API. The typestate Access
in these types tracks whether the
access is unique, shared, or exclusive to the current thread. For more information,
see the type-level documentation on Ref
.
Implementations
Creates a new instance of this object.
This is a reference-counted type. The returned object is automatically managed
by Ref
.
Sets the currently visible frame of the texture.
Animation speed in frames per second. This value defines the default time interval between two frames of the animation, and thus the overall duration of the animation loop based on the [member frames] property. A value of 0 means no predefined number of frames per second, the animation will play according to each frame’s frame delay (see [method set_frame_delay]).
For example, an animation with 8 frames, no frame delay and a fps
value of 2 will run for 4 seconds, with each frame lasting 0.5 seconds.
Returns the given frame’s delay value.
Returns the given frame’s Texture.
Number of frames to use in the animation. While you can create the frames independently with [method set_frame_texture], you need to set this value for the animation to take new frames into account. The maximum number of frames is [constant MAX_FRAMES].
If true
, the animation will only play once and will not loop back to the first frame after reaching the end. Note that reaching the end will not set [member pause] to true
.
If true
, the animation will pause where it currently is (i.e. at [member current_frame]). The animation will continue from where it was paused when changing this property to false
.
Sets the currently visible frame of the texture.
Animation speed in frames per second. This value defines the default time interval between two frames of the animation, and thus the overall duration of the animation loop based on the [member frames] property. A value of 0 means no predefined number of frames per second, the animation will play according to each frame’s frame delay (see [method set_frame_delay]).
For example, an animation with 8 frames, no frame delay and a fps
value of 2 will run for 4 seconds, with each frame lasting 0.5 seconds.
Sample code is GDScript unless otherwise noted.
Sets an additional delay (in seconds) between this frame and the next one, that will be added to the time interval defined by [member fps]. By default, frames have no delay defined. If a delay value is defined, the final time interval between this frame and the next will be 1.0 / fps + delay
.
For example, for an animation with 3 frames, 2 FPS and a frame delay on the second frame of 1.2, the resulting playback will be:
Frame 0: 0.5 s (1 / fps)
Frame 1: 1.7 s (1 / fps + 1.2)
Frame 2: 0.5 s (1 / fps)
Total duration: 2.7 s
Assigns a Texture to the given frame. Frame IDs start at 0, so the first frame has ID 0, and the last frame of the animation has ID [member frames] - 1. You can define any number of textures up to [constant MAX_FRAMES], but keep in mind that only frames from 0 to [member frames] - 1 will be part of the animation.
Number of frames to use in the animation. While you can create the frames independently with [method set_frame_texture], you need to set this value for the animation to take new frames into account. The maximum number of frames is [constant MAX_FRAMES].
If true
, the animation will only play once and will not loop back to the first frame after reaching the end. Note that reaching the end will not set [member pause] to true
.
Methods from Deref<Target = Texture>
Draws the texture using a CanvasItem with the VisualServer API at the specified position
. Equivalent to [method VisualServer.canvas_item_add_texture_rect] with a rect at position
and the size of this Texture.
Default Arguments
modulate
-Color( 1, 1, 1, 1 )
transpose
-false
normal_map
-null
Draws the texture using a CanvasItem with the VisualServer API. Equivalent to [method VisualServer.canvas_item_add_texture_rect].
Default Arguments
modulate
-Color( 1, 1, 1, 1 )
transpose
-false
normal_map
-null
Draws a part of the texture using a CanvasItem with the VisualServer API. Equivalent to [method VisualServer.canvas_item_add_texture_rect_region].
Default Arguments
modulate
-Color( 1, 1, 1, 1 )
transpose
-false
normal_map
-null
clip_uv
-true
The texture’s [enum Flags]. [enum Flags] are used to set various properties of the Texture.
Returns the texture height.
Trait Implementations
type RefKind = RefCounted
type RefKind = RefCounted
Creates an explicitly null reference of Self
as a method argument. This makes type
inference easier for the compiler compared to Option
. Read more
Creates a new instance of Self
using a zero-argument constructor, as a Unique
reference. Read more
Performs a dynamic reference downcast to target type. Read more
Performs a static reference upcast to a supertype that is guaranteed to be valid. Read more
Creates a persistent reference to the same Godot object with shared thread access. Read more
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
unsafe fn assume_thread_local(&self) -> Ref<Self, ThreadLocal> where
Self: GodotObject<RefKind = RefCounted>,
Creates a persistent reference to the same Godot object with thread-local thread access. Read more
Creates a persistent reference to the same Godot object with unique access. Read more
Recovers a instance ID previously returned by Object::get_instance_id
if the object is
still alive. See also TRef::try_from_instance_id
. Read more
Auto Trait Implementations
impl RefUnwindSafe for AnimatedTexture
impl !Send for AnimatedTexture
impl !Sync for AnimatedTexture
impl Unpin for AnimatedTexture
impl UnwindSafe for AnimatedTexture