bevyengine / bevyengine/bevy

Inconsistent logic in RepeatAnimation

Open
#22,868 0 comments 0 reactions 0 assignees View on GitHub
A-Animation C-Docs C-Refinement S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Description

I think that `RepeatAnimation`'s logic is inconsistent between the Never and Count case. If you chose `RepeatAnimation::Never`, the animation will play once since it never repeat. Then if we apply the same logic, we would expect `RepeatAnimation::Count(0)` to have the same behavior, but we actually need to use `RepeatAnimation(1)` to have the same behavior.

## Solution

Either change `RepeatAnimation::Count(0)` to behave like `RepeatAnimation::Never` or rename `RepeatAnimation::Never` to `RepeatAnimation::Once`. In my opinion the first option is better since the name of the enum is `RepeatAnimation`. Repeating something once is to do it twice, so it's logic that `RepeatAnimation::Count(1)` plays the animation twice. For the second option, I think the enum should be rename to something like `PlayAnimation` since there would no longer be the notion of repetition.

Contributor guide

Open the contributing guide

Research direction

Locate the RepeatAnimation definition and the handling for Never and Count values. Compare the current behavior for Count(0), Count(1), and Never, then review the project’s existing animation tests or add coverage for the agreed semantics; done means the chosen behavior is consistent and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.