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

Feature: consecutive mode #44

Merged
merged 5 commits into from
Mar 6, 2023
Merged

Conversation

teaualune
Copy link
Contributor

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:

  • Adjust some syntax in README.md
  • Fix a lint error near UIManager.measure

The "consecutive" mode is only valid under loop = true condition, and it tweaks the animation loop into the following sequence:

  1. Run the first timing animation: move marquee text from position = 0 to position = -marqueeTextWidth.current, so marquee text will be moved completely outside of the container
  2. Reset marquee text to position = containerWidth.current (namely resetToValue) via a 0-duration timing animation. This moves marquee text to the right side of container, preparing to show again
  3. Run the second timing animation: move marquee text from position = containerWidth.current to position = -marqueeTextWidth.current
  4. Repeat 2 and 3

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

@kyo504
Copy link
Owner

kyo504 commented Feb 26, 2023

@teaualune First, very sorry for late response. and thank you for your contribution. If you don't mind, could you rebase this?

@teaualune
Copy link
Contributor Author

@kyo504 I've rebased the PR and rewrites the example to HomeScreen, please tell me if there's anything that need to be adjusted, thanks!

Copy link
Owner

@kyo504 kyo504 left a comment

Choose a reason for hiding this comment

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

@teaualune LGTM! Thanks for your PR.

@kyo504 kyo504 merged commit 5f87fb6 into kyo504:master Mar 6, 2023
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