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

Skip zero delay #6398

Merged
merged 5 commits into from
Aug 27, 2024
Merged

Skip zero delay #6398

merged 5 commits into from
Aug 27, 2024

Conversation

Latropos
Copy link
Contributor

@Latropos Latropos commented Aug 9, 2024

Summary

Closes #6341

Probably we want to fix the comparison inside withDelay to start the delayed animation as soon as the conditions are fulfilled, instead of waiting an additional frame.

-if (now - startTime > delayMs || animation.reduceMotion) {
+if (now - startTime >= delayMs || animation.reduceMotion) {

With this fix the delay of 0ms is only visible if you are really picky:

Test plan

Includes simplification of tests of withDelay. Tested on both IOS and Android

BEFORE AFTER
Screen.Recording.2024-07-29.at.12.22.55.mov
Screen.Recording.2024-08-09.at.13.03.32.mov

@Latropos Latropos marked this pull request as ready for review August 9, 2024 11:36
Copy link
Member

@piaskowyk piaskowyk left a comment

Choose a reason for hiding this comment

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

Please take to consider my previous comments, but overall seems to be good 👍

@Latropos Latropos added this pull request to the merge queue Aug 27, 2024
Merged via the queue into main with commit b7c542f Aug 27, 2024
8 checks passed
@Latropos Latropos deleted the acynk/zero-delay-fix branch August 27, 2024 09:51
tjzel pushed a commit that referenced this pull request Aug 28, 2024
## Summary

Closes
#6341

Probably we want to fix the comparison inside `withDelay` to start the
delayed animation as soon as the conditions are fulfilled, instead of
waiting an additional frame.

```diff
-if (now - startTime > delayMs || animation.reduceMotion) {
+if (now - startTime >= delayMs || animation.reduceMotion) {
```

With this fix the delay of 0ms is only visible if you are really picky:

<table>
<tr>
<td> BEFORE </td>
<td> AFTER </td>
</tr>
<tr>
<td> 


https://github.com/user-attachments/assets/261d92d2-f302-4240-96c8-3d14352431c2

</td>
<td> 


https://github.com/user-attachments/assets/cf833359-7440-41d1-ab0a-daa3050bae15

</td>
</tr>

### Test plan

Includes simplification of tests of withDelay. Tested on both IOS and
Android
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.

WithDelay of 0ms should not cause any delay
2 participants