-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 CurvedTransition
#6239
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can try a bit different approach like here - https://tobiasahlin.com/blog/curved-path-animations-in-css/
packages/react-native-reanimated/src/layoutReanimation/web/componentUtils.ts
Outdated
Show resolved
Hide resolved
Main problem with using Current approach does almost the same thing, but clones element rather than using I think we can stick to current approach, but I'm open to discussion. |
Summary
This PR adds
CurvedTransition
to set of transitions available on web.This transition is different from others, therefore logic behind its creation is also different.
Logic
Logic behind this transition is a bit complicated since CSS does not allow to specify different easings to different properties.
In order to achieve desired effect, we have to use second component. One of them will run animation along
Y
axis and the other one alongX
axis. This will result in child component being animated with combined easings.Current logic works as follows:
element
with layout transitiondummy
styles, so that it is placed exactly atelements
positionelements
children and setelement
background color totransparent
dummy
aselement
childelement
anddummy
dummy
from children ofelement
element
and bring back old background colorExamples
Nagranie.z.ekranu.2024-07-9.o.14.55.12.mov
Nagranie.z.ekranu.2024-07-9.o.14.54.21.mov
Limitations
Currently
CurvedTransition
is not applied towidth
/height
. Also I'm not yet sure how it interacts with background images.Test plan
Verified on
DefaultLayoutTransitions
example (witheasingX
changed tosin
andeasingY
toexp
).