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

[Web LA] Add EntryExitTransition #6232

Merged
merged 19 commits into from
Jul 16, 2024
Merged

Conversation

m-bert
Copy link
Contributor

@m-bert m-bert commented Jul 8, 2024

Summary

This PR adds EntryExitTransition to set of transitions available on web.

This transition is different from others, therefore logic behind its creation is also different.

Two animations

First approach was to run 2 animations - exiting and entering. While it seemed like an easier approach, there were few problems:

  • It lead to many code duplications (especially when starting animation, handling end/cancel)
  • I couldn't find a way to keep elements in good positions (transform was overriden by animations and we need to use it to put element back in its starting position)

While I haven't observed any flickers caused by having 2 animations, arguments above made me try seconds approach)

Dynamic keyframe

Second approach to this problem involves creating dynamic keyframe animation - just like in case of other transitions. First we obtain data of both exiting and entering animations. Then we perform two operations:

  1. We add calculated transform into exiting animation (unshift is used to make sure that it will be placed at the beginning of keyframe timestamps
  2. We merge two animations object into one keyframe data object.

In 2. we have to make sure that both animations will fit in one keyframe, therefore exiting animation is squeezed into interval [0,49] and entering animation runs from 50 to 100.

Examples

Nagranie.z.ekranu.2024-07-8.o.14.28.38.mov
Nagranie.z.ekranu.2024-07-8.o.14.42.40.mov

Test plan

Verified on DefaultLayoutTransitions example.

@m-bert m-bert marked this pull request as ready for review July 8, 2024 12:43
@m-bert m-bert requested a review from piaskowyk July 8, 2024 12:43
@m-bert m-bert requested a review from piaskowyk July 16, 2024 09:02
@m-bert m-bert added this pull request to the merge queue Jul 16, 2024
Merged via the queue into main with commit bba2419 Jul 16, 2024
6 checks passed
@m-bert m-bert deleted the @mbert/add-entry-exit-transition branch July 16, 2024 13:56
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