summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorYuri Sizov <11782833+YuriSizov@users.noreply.github.com>2022-09-08 18:25:35 +0300
committerGitHub <noreply@github.com>2022-09-08 18:25:35 +0300
commit141fdac36c0eb595dd11b27817446e42326bf2a0 (patch)
treef6bb46b9a28c9fb657664424415599f39d98b31a /doc/classes
parent4287bebd5b6ec7b5d2346cda06acc4259208c8c2 (diff)
parent9c9c5f662f0ea231412eda5097b1cc585889fed2 (diff)
Merge pull request #65188 from Mickeon/animated-texture-speed-scale
Rework AnimatedTexture's `fps` into `speed_scale`
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/AnimatedTexture.xml26
1 files changed, 9 insertions, 17 deletions
diff --git a/doc/classes/AnimatedTexture.xml b/doc/classes/AnimatedTexture.xml
index d2fa7bb1e9..f0c86ba47b 100644
--- a/doc/classes/AnimatedTexture.xml
+++ b/doc/classes/AnimatedTexture.xml
@@ -5,18 +5,18 @@
</brief_description>
<description>
[AnimatedTexture] is a resource format for frame-based animations, where multiple textures can be chained automatically with a predefined delay for each frame. Unlike [AnimationPlayer] or [AnimatedSprite2D], it isn't a [Node], but has the advantage of being usable anywhere a [Texture2D] resource can be used, e.g. in a [TileSet].
- The playback of the animation is controlled by the [member fps] property as well as each frame's optional delay (see [method set_frame_delay]). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame.
+ The playback of the animation is controlled by the [member speed_scale] property, as well as each frame's duration (see [method set_frame_duration]). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame.
[AnimatedTexture] currently requires all frame textures to have the same size, otherwise the bigger ones will be cropped to match the smallest one.
[b]Note:[/b] AnimatedTexture doesn't support using [AtlasTexture]s. Each frame needs to be a separate [Texture2D].
</description>
<tutorials>
</tutorials>
<methods>
- <method name="get_frame_delay" qualifiers="const">
+ <method name="get_frame_duration" qualifiers="const">
<return type="float" />
<param index="0" name="frame" type="int" />
<description>
- Returns the given frame's delay value.
+ Returns the given [param frame]'s duration, in seconds.
</description>
</method>
<method name="get_frame_texture" qualifiers="const">
@@ -26,19 +26,12 @@
Returns the given frame's [Texture2D].
</description>
</method>
- <method name="set_frame_delay">
+ <method name="set_frame_duration">
<return type="void" />
<param index="0" name="frame" type="int" />
- <param index="1" name="delay" type="float" />
+ <param index="1" name="duration" type="float" />
<description>
- 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 [code]1.0 / fps + delay[/code].
- 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:
- [codeblock]
- 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
- [/codeblock]
+ Sets the duration of any given [param frame]. The final duration is affected by the [member speed_scale]. If set to [code]0[/code], the frame is skipped during playback.
</description>
</method>
<method name="set_frame_texture">
@@ -55,10 +48,6 @@
<member name="current_frame" type="int" setter="set_current_frame" getter="get_current_frame">
Sets the currently visible frame of the texture.
</member>
- <member name="fps" type="float" setter="set_fps" getter="get_fps" default="4.0">
- 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 [code]fps[/code] value of 2 will run for 4 seconds, with each frame lasting 0.5 seconds.
- </member>
<member name="frames" type="int" setter="set_frames" getter="get_frames" default="1">
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].
</member>
@@ -68,6 +57,9 @@
<member name="pause" type="bool" setter="set_pause" getter="get_pause" default="false">
If [code]true[/code], 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 [code]false[/code].
</member>
+ <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0">
+ The animation speed is multiplied by this value. If set to a negative value, the animation is played in reverse.
+ </member>
</members>
<constants>
<constant name="MAX_FRAMES" value="256">