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

fix: jumping when aligned at bottom (#69) #211

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

94726
Copy link

@94726 94726 commented Aug 8, 2024

This fixes #69, by only applying the deltaX/Y when the element seems to have moved either via deltaTop or deltaBottom etc.

FixedAAJump.mp4

I also added a debounce skip to updatePos, for when the animations finish, as it delayed having accurate oldPos.

This caused elements to be offset when triggering auto-animate shortly after the animations ended.
AASlowUpdatePos.mp4

Ultimately this makes it possible to use auto-animate for building trays/bottom-sheets like this

recreation of https://emilkowal.ski/ui/family-tray-system

DynamicBottomSheetWithAutoanimate.mp4

Copy link

vercel bot commented Aug 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auto-animate ❌ Failed (Inspect) Aug 8, 2024 7:39pm

@arjunsahai
Copy link

Hi, thanks for solving #69. I was wondering if there's any way I could help move this PR forward or if there's any additional information needed? @94726

Thanks :)

@94726
Copy link
Author

94726 commented Sep 18, 2024

Hi, thanks for solving #69. I was wondering if there's any way I could help move this PR forward or if there's any additional information needed? @94726

So this fix itself is pretty much done. But I think it's hard to tell whether this is a sensible approach as there aren't any tests that confirm the expected behavior of auto-animate in general. This might very well break something that I didn't account for as I only checked whether the docs still animate like before. Unfortunately I don't have experience in testing things like this and cannot provide much help.

But if this PR is of use to you, you might aswell try it in your applications @arjunsahai.
As auto-animate is pretty small in size, you could just copy the index.ts in this PR and be good to go.

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.

Animation bug when remove element
2 participants