Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation: Document frame duration units in SpriteFrames #93233

Merged

Conversation

dalexeev
Copy link
Member

@dalexeev dalexeev commented Jun 16, 2024

The units are already documented in detail, I think we can just refer to get_frame_duration(), without the reverse formula.

<method name="get_frame_duration" qualifiers="const">
<return type="float" />
<param index="0" name="anim" type="StringName" />
<param index="1" name="idx" type="int" />
<description>
Returns a relative duration of the frame [param idx] in the [param anim] animation (defaults to [code]1.0[/code]). For example, a frame with a duration of [code]2.0[/code] is displayed twice as long as a frame with a duration of [code]1.0[/code]. You can calculate the absolute duration (in seconds) of a frame using the following formula:
[codeblock]
absolute_duration = relative_duration / (animation_fps * abs(playing_speed))
[/codeblock]
In this example, [code]playing_speed[/code] refers to either [method AnimatedSprite2D.get_playing_speed] or [method AnimatedSprite3D.get_playing_speed].
</description>
</method>

Copy link
Contributor

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every description around AnimatedSprite could be far improved upon, but it's better than nothing.

@akien-mga akien-mga merged commit 63cb43a into godotengine:master Jun 17, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@dalexeev dalexeev deleted the anim-doc-sprite-frames-frame-duration branch June 18, 2024 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants