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

Animate Persence inconsistencies with Framer Motion API #2

Open
Omicrxn opened this issue Oct 5, 2024 · 7 comments · May be fixed by #7
Open

Animate Persence inconsistencies with Framer Motion API #2

Omicrxn opened this issue Oct 5, 2024 · 7 comments · May be fixed by #7
Assignees

Comments

@Omicrxn
Copy link

Omicrxn commented Oct 5, 2024

First and foremost, nice work forking svelte-motion because it's such a needed library in the svelte ecosystem but the lack of maintenance is horrible.

One thing I'm noticing on the Animate Presence is that the API built on the original library is quite different over Framer Motion's. I understand things like why the list is done, even though maybe it is more friendlier to let the developers put the key's themselves, with Svelte syntax like in react. However I don't know the internals so this is not really a big problem. However there is a property exitBeforeEnter which I guess it mimicks the mode="wait" of Framer Motion. I think we should copy the API's and also add the lacking mode="popLayout".

Finally there is a bug where setting initial={false} which is supposed to only remove the first render initial animation, but instead it removes all initial animations that follow.

Overall I think keeping a close syntax to Framer Motion would help to translate examples found in react, or even developers transitioning from Framer.

Thanks for the great work!

PD: I'm using Svelte 5, maybe the bug about initials is due to that, haven't tested it on Svelte 4.

@JonathonRP
Copy link
Owner

@Omicrxn, thank you for this. Yes I plan on making it closer to react framer-motion that was the main reason for forking. There is a bunch of dead code and paths that need to clean up, so ported to typescript to have confidence in cleaning up correctly and being able to add features correctly. I found that initial prop big too in my usage and I think it has to deal with using react code react always rerenders full component but svelte is different. I think we'll be able to fix using svelte 5. I have plans to add more=pop layout.

@Omicrxn
Copy link
Author

Omicrxn commented Oct 5, 2024

@JonathonRP I have been looking at it and I don't even know if something like framer motion makes sense in Svelte, it's exactly what you said, framer has a lot of things around React's limitations, which aren't needed in Svelte, plus svelte/motion svelte/animate and svelte/transitions are actually very powerful. So maybe it even makes more sense to use that as a base to reduce bundle size and even follow Svelte actions as the way to use the library (no need for Motion element or motion.whatever elements). This should be further looked up but just wanted to share my random thoughts in case they help.

@JonathonRP
Copy link
Owner

@JonathonRP I have been looking at it and I don't even know if something like framer motion makes sense in Svelte, it's exactly what you said, framer has a lot of things around React's limitations, which aren't needed in Svelte, plus svelte/motion svelte/animate and svelte/transitions are actually very powerful. So maybe it even makes more sense to use that as a base to reduce bundle size and even follow Svelte actions as the way to use the library (no need for Motion element or motion.whatever elements). This should be further looked up but just wanted to share my random thoughts in case they help.

I was planning to do that too, actually but still use motion.el for API surface and keep it close to framer motion API but internally will be more svelte powered

@Omicrxn
Copy link
Author

Omicrxn commented Oct 5, 2024

@JonathonRP Amazing, that would be great!

@JonathonRP
Copy link
Owner

@JonathonRP Amazing, that would be great!

Yeah major reason I decided to fork, I like the declarative nature of framer-motion and it's animations but felt it could be better implemented internally with svelte and could add a action that has the power and config of framer motion

@JonathonRP
Copy link
Owner

@Omicrxn also feel free to join discord community discussion at https://discord.gg/jS99Ns6g

@JonathonRP
Copy link
Owner

Also for the animatePresence mode='poplayout' you can use exit before enter = false and element style = position absolute and parent style position = relative this is also what is happening under the hood of mode = pop layout

@JonathonRP JonathonRP self-assigned this Oct 12, 2024
@JonathonRP JonathonRP linked a pull request Nov 20, 2024 that will close this issue
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 a pull request may close this issue.

2 participants