ImageFrames¶
Inherits: Resource < Reference < Object
A container for Image frames.
Description¶
A class used to load and arrange a sequence of image frames. Allows to load animated image formats externally (only GIF is supported currently). Each frame can specify a delay for animated images. The data can then be used to generate an AnimatedTexture or a SpriteFrames via script.
Methods¶
void | add_frame ( Image image, float delay, int idx=-1 ) |
void | clear ( ) |
int | get_frame_count ( ) const |
float | get_frame_delay ( int idx ) const |
Image | get_frame_image ( int idx ) const |
Error | load ( String path, int max_frames=0 ) |
Error | load_gif_from_buffer ( PoolByteArray data, int max_frames=0 ) |
void | remove_frame ( int idx ) |
void | set_frame_delay ( int idx, float delay ) |
void | set_frame_image ( int idx, Image image ) |
Method Descriptions¶
Adds a new frame.
- void clear ( )
Removes all frames.
- int get_frame_count ( ) const
Returns the total number of frames.
Returns the delay of frame idx
.
Returns the Image of frame idx
.
Loads the data from a file located at path
. Recognizes the following file extensions: gif
. The max_frames
parameter limits the number of frames which can be loaded.
- Error load_gif_from_buffer ( PoolByteArray data, int max_frames=0 )
Loads the data from a PoolByteArray GIF buffer. The max_frames
parameter limits the number of frames which can be loaded.
- void remove_frame ( int idx )
Removes the frame idx
.
Sets the delay in seconds of frame idx
.
Sets the Image of frame idx
.