Skip to content

Clamp input to animEffect() - #2149

Merged
nesbox merged 1 commit into
nesbox:mainfrom
Madadog:clamp-anim-ticks-1
Mar 2, 2023
Merged

nesbox merged 1 commit into
nesbox:mainfrom
Madadog:clamp-anim-ticks-1

Conversation

@Madadog

@Madadog Madadog commented Mar 2, 2023

Copy link
Copy Markdown
Contributor

Fixes #1913.

animEffect() seems to expect a value between 0 and 1, and #1913 is caused by the surf coverFade animation lerping past 1, which feeds values greater than 256 into fadePalette(), causing the flashing colors. This PR clamps movie ticks for each item ensuring animEffect won't receive values > 1.

This could create issues if any animation items rely on playing past their end. I didn't notice any while visually checking the editor and surf menu animations, but I could easily have missed something.

It might be better to move this clamp directly to the start of animEffect().

Alternative fixes for #1913 include clamping the fadePalette() value between 0 and 256, or stopping the animation at the right time.

Fixes nesbox#1913.

animEffect() seems to expect a value between 0 and 1, and nesbox#1913 is caused by the surf coverFade animation lerping past 1, which feeds values greater than 256 into fadePalette(), causing the flashing colors. This PR clamps movie ticks for each item ensuring animEffect won't receive values > 1.

This could create issues if any animation items rely on playing past their end. I didn't notice any while visually checking the editor and surf menu animations, but I could easily have missed something.

It might be better to move this clamp directly to the start of animEffect().

Alternative fixes for nesbox#1913 include clamping the fadePalette() value between 0 and 256, or stopping the animation at the right time.
@nesbox
nesbox merged commit 40c5f2d into nesbox:main Mar 2, 2023
@nesbox

nesbox commented Mar 2, 2023

Copy link
Copy Markdown
Owner

Thank you for pointing me to where this is going, because I've tried to investigate issue #1913 without success.

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.

Flashing colors in surf menu

2 participants