Skip to content

useSpring chokes under load #238

@J-Sek

Description

@J-Sek

System info

- Operating System: Linux
- Node Version:     v18.20.3
- Nuxt Version:     3.13.0
- CLI Version:      3.13.1
- Nitro Version:    2.9.7
- Package Manager:  npm@10.2.3
- User Config:      modules
- Runtime Modules:  @nuxtjs/tailwindcss@6.12.1

Reproduction

Circle follows the mouse coordinates only if I move very slowly

demo


Edit: I managed to get somewhat decent result with transition: all 0.1s linear on circle and bounce at least 1.0, but it is far from perfect.

Describe the bug

But despite the best efforts it only works if I throttle set(...) calls with delay of at least the spring duration which defeats the goal of this code. When throttle is low (just enough to avoid stressing the browser... maybe it should not be necessary) with regular mouse movements, the coordinates get null values.

Additional context

I was looking for a way to reproduce spring effect I can see in Svelte tutorial.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions