-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Public API for creating Animation from the svelte/transition module #9911
Comments
Something like this would be pretty sweet, especially for SEO purposes. Think collapsible/accordion components where the content is collapsed until opened. If you use Justification for adding to the framework vs just having everyone create their own is some form of soft standardization/predictability across the ecosystem. |
Working right on DOM elements isn't svelty way. For collapsing elements, there is svelte-collapse (though it needs a fix for folding margins, padding, and borders) and svelte-collapsible build on top of the former. For many other cases, CSS transition and animation usually provide enough flexibility. For other cases involving more complex animations, you may want to use svelte-motion or some other animation lib. And, after all, it is possible to copy the transitions into its own library and expose them via whatever interface you want. |
Both of those projects work "right on DOM elements" via an action |
It's just that Svelte offers a simple and effective transition module, but which is restricted to So we have all the basic, except that we cannot invoke it directly without add/removing nodes... It's not a "big deal", but it could be practical. |
@huntabyte I'm about /** @type {HTMLElement} */
let dom = ...
const anim = createAnim(dom, slide, {duration: 500, easing: quintOut}); Exposing an element into a |
Describe the problem
The
svelte/transition
module is really useful and easy to use, but it is restricted to the template and the{#if}
/{#each}
blocks.It would be convenient to be able to use them manually if needed.
Describe the proposed solution
Provide a public fonction for creating animation based on the
svelte/transition
module.Something like this :
transition
will be a object Animation or TickAnimation, with method likeplay()
,pause()
,reverse()
,cancel()
,finish()
and oneonfinish
handlerExample in this REPL, where transition.js mainly consists of code from internal/client/transition.js
Alternatives considered
Use duplicate code or another library
Importance
would make my life easier
The text was updated successfully, but these errors were encountered: