跳转至

SpriteFrames

继承

Resource

简要描述

AnimatedSprite的精灵帧库。

描述

用于AnimatedSprite的精灵帧库。

成员

类型 属性名 默认值
Array frames

方法

返回值类型 方法名称
void add_animation(anim: String)
void add_frame(anim: String, frame: Texture, at_position: int = -1)
void clear(anim: String)
void clear_all()
bool get_animation_loop(anim: String) const
PoolStringArray get_animation_names() const
float get_animation_speed(anim: String) const
Texture get_frame(anim: String, idx: int) const
int get_frame_count(anim: String) const
bool has_animation(anim: String) const
void remove_animation(anim: String)
void remove_frame(anim: String, idx: int)
void rename_animation(anim: String, newname: String)
void set_animation_loop(anim: String, loop: bool)
void set_animation_speed(anim: String, speed: float)
void set_frame(anim: String, idx: int, txt: Texture)

常量

成员说明

  • Array frames
setter _set_frames(value)
getter _get_frames

方法说明

  • add_animation add_animation(anim: String)

将新动画添加到库中。


  • add_frame add_frame(anim: String, frame: Texture, at_position: int = -1)

将帧添加到给定的动画。


  • clear clear(anim: String)

从给定动画中删除所有帧。


  • clear_all clear_all()

删除所有动画。


  • get_animation_loop get_animation_loop(anim: String) const

如果true,则给定的动画将循环播放。


  • get_animation_names get_animation_names() const

返回一个数组,其中包含与每个动画关联的名字。


  • get_animation_speed get_animation_speed(anim: String) const

动画的速度,以每秒帧数为单位。


  • get_frame get_frame(anim: String, idx: int) const

返回动画的选定帧。


  • get_frame_count get_frame_count(anim: String) const

返回指定动画中的帧数。


  • has_animation has_animation(anim: String) const

如果true,则存在指定的动画。


  • remove_animation remove_animation(anim: String)

删除给定的动画。


  • remove_frame remove_frame(anim: String, idx: int)

删除动画的选定帧。


  • rename_animation rename_animation(anim: String, newname: String)

将动画的名称更改为newname


  • set_animation_loop set_animation_loop(anim: String, loop: bool)

如果true,则动画将循环播放。


  • set_animation_speed set_animation_speed(anim: String, speed: float)

动画的速度,以每秒帧数为单位。


  • set_frame set_frame(anim: String, idx: int, txt: Texture)

设置给定帧的纹理。