Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since I'm facing the same problem described in #1 and not finding an existing solution, I propose this PR to implement the feature. I called it "consecutive" but the term can be changed according to reviewer's suggestion.
This PR includes the consecutive feature as well as several minor fixes:
UIManager.measure
The "consecutive" mode is only valid under
loop = true
condition, and it tweaks the animation loop into the following sequence:0
to position =-marqueeTextWidth.current
, so marquee text will be moved completely outside of the containercontainerWidth.current
(namelyresetToValue
) via a 0-duration timing animation. This moves marquee text to the right side of container, preparing to show againcontainerWidth.current
to position =-marqueeTextWidth.current
The complex duration calculations at line 167 and 172 are aimed to maintain same velocity between consecutive mode and the existing behavior.
Here is a sample video demonstrating both existing behavior and consecutive mode: https://imgur.com/a/54D46o2