News for hackers. Stuff that matters.
Re:Show HN: Svader – Create GPU-rendered Svelte components by rubatuga on Saturday December 14, 2024 @10:39AM (#42417747)
Any plans to integrate this with an animation engine? I've found Svelte animations little bit buggy however. Also are the limitations of 3D just a design choice? Thanks for the HN post.
Re:Show HN: Svader – Create GPU-rendered Svelte components by sokmastr on Saturday December 14, 2024 @10:59AM (#42417832)
I haven't thought about it, but I'm open to the idea. What kind of animation engines do you have in mind?

Yes, the absence of 3D is very much a choice. I believe this need is already covered pretty well by existing libraries like three.js and threlte etc. These are relatively large and complex to use, because you essentially have to adopt the mental model of having a whole 3D scene or something like that. With Svader, the mental model is just that you have a canvas with an attached fragment shader, which paints the canvas with respect to some input parameters.

Re:Show HN: Svader – Create GPU-rendered Svelte components by rubatuga on Saturday December 14, 2024 @09:43PM (#42421100)
I don't have a lot of experience but https://animejs.com/ comes to mind. I'm not sure how the rendering works in WebGPU with changing inputs either. For example, does Svader cap at 60fps or the browser refresh rate? Do you use requestAnimationFrame? Thanks again.
Re:Show HN: Svader – Create GPU-rendered Svelte components by sokmastr on Sunday December 15, 2024 @02:46AM (#42422159)
If the animation engine is capable of smoothly changing a value in JS, I think it would already integrate very well with Svader.

The way the reactive rerendering works, is that every time a change in the input parameters is detected it queues a requestAnimationFrame, so yes, it follows the browser refresh rate.

Since Svelte 5 is automatically able to track changes in values, both by reassignment as well as object mutation, anything that changes a value -- no matter if it's designed for Svelte or not -- should be able to integrate smoothly.