sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.67k stars 4.13k forks source link

Expose `set_raf` in Svelte 5 #12133

Closed grischaerbe closed 2 months ago

grischaerbe commented 3 months ago

Describe the problem

The usage of requestAnimationFrame-based tweened and spring fails in XR since an XRSession provides its own requestAnimationFrame.

With Svelte 4, Threlte was able to provide the appropriate requestAnimationFrame via set_raf (implemented here) but this ability is currently missing in Svelte 5.

Describe the proposed solution

Expose a method to set the driver of tweened and spring and other motion-based utilities, possibly per-instance.

Importance

nice to have

paoloricciuti commented 3 months ago

Can't you import raf and update the tick function?

trueadm commented 2 months ago

Can't you import raf and update the tick function?

You should be able to do this. Closing as this appears to work.