Skip to content

fix: keep animation error#863

Merged
MakinoharaShoko merged 1 commit intoOpenWebGAL:devfrom
HardyNLee:fix/keep-animation
Feb 7, 2026
Merged

fix: keep animation error#863
MakinoharaShoko merged 1 commit intoOpenWebGAL:devfrom
HardyNLee:fix/keep-animation

Conversation

@HardyNLee
Copy link
Contributor

介绍

修复 setTempAnimationsetAnimation 还在播 keep 动画时, 目标对象提前退场, 导致的后续所有动画失效的问题

本质上是 #775 方案的延续, 但是那个 PR 只处理了 setTransform

测试

下面这段代码多试几次, 多滚滚轮, 此 PR 前有概率造成所有动画失效

label:loop;
;
changeFigure:stand.webp -id=aaa -next;
:出场;
setTempAnimation:[{"duration":0}, {"scale":{"x":5, "y":5}, "duration":10000}] -target=aaa -keep -next;
:keep;
changeFigure:none -id=aaa -next;
:退场;
;
jumpLabel:loop;

@gemini-code-assist
Copy link

Summary of Changes

Hello @HardyNLee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在解决 setAnimationsetTempAnimation 函数中存在的动画错误。当一个带有 keep 标志的动画正在播放时,如果其目标对象提前从舞台上移除,可能会导致后续的所有动画指令失效。本次修复通过引入一个状态标志和优化动画停止机制,确保即使目标对象提前退场,动画也能被正确处理和清理,从而避免了动画系统进入不一致状态,提高了系统的健壮性。

Highlights

  • 动画错误修复: 修复了 setAnimationsetTempAnimation 中,当目标对象在“保持”动画播放期间提前退场时,导致后续所有动画失效的问题。
  • 引入 keepAnimationStopped 标志: 在 setAnimationsetTempAnimation 中引入了 keepAnimationStopped 标志,以防止已停止的“保持”动画被重新初始化,从而避免了动画状态的冲突。
  • 优化“保持”动画停止逻辑: 调整了“保持”动画的停止逻辑,确保在目标对象退场时能够正确调用 removeAnimationWithoutSetEndState 进行清理,而不会影响对象的最终状态。
  • 代码清理: 移除了 setAnimationsetTempAnimationsetTransform 函数中未使用的 startDialogKey 变量,提高了代码的整洁性。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • packages/webgal/src/Core/gameScripts/setAnimation.ts
    • 移除了未使用的 startDialogKey 变量。
    • 引入了 keepAnimationStopped 标志,以防止重复启动已停止的“保持”动画。
    • 修改了 stopFunction,对于“保持”动画,现在会调用 removeAnimationWithoutSetEndState 并设置 keepAnimationStoppedtrue,以确保正确清理。
  • packages/webgal/src/Core/gameScripts/setTempAnimation.ts
    • 移除了未使用的 startDialogKey 变量。
    • 引入了 keepAnimationStopped 标志,以防止重复启动已停止的“保持”动画。
    • 修改了 stopFunction,对于“保持”动画,现在会调用 removeAnimationWithoutSetEndState 并设置 keepAnimationStoppedtrue,以确保正确清理。
  • packages/webgal/src/Core/gameScripts/setTransform.ts
    • 移除了未使用的 startDialogKey 变量。
Activity
  • 作者 HardyNLee 创建了此拉取请求,旨在修复动画系统中的一个关键错误。
  • 提供了详细的中文描述,解释了问题背景、修复方案以及一个用于复现和验证的测试用例。
  • 提交了对 setAnimation.tssetTempAnimation.tssetTransform.ts 文件的代码更改。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

这个 PR 旨在修复当使用 setTempAnimationsetAnimationkeep 动画时,若目标对象提前退场,会导致后续所有动画失效的 bug。您通过引入 keepAnimationStopped 标志位来处理竞态条件,并在 stopFunction 中为 keep 动画调用 removeAnimationWithoutSetEndState,从而避免在已销毁的对象上执行操作。这个修复方案看起来是正确且有效的,并且与之前在 setTransform 中应用的方案保持了一致。

审查中,我发现 setAnimationsetTempAnimationsetTransform 之间存在大量重复的逻辑。为了提高代码的可维护性,我已在评论中建议将这些通用逻辑提取到一个共享的辅助函数中。

@MakinoharaShoko MakinoharaShoko merged commit f34272e into OpenWebGAL:dev Feb 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants