Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[feat]: Better events for SpringValue. #2322

Open
1216892614 opened this issue Sep 23, 2024 · 2 comments
Open

[feat]: Better events for SpringValue. #2322

1216892614 opened this issue Sep 23, 2024 · 2 comments
Labels
template: request is a request someone has submitted

Comments

@1216892614
Copy link

1216892614 commented Sep 23, 2024

A clear and concise description of what the feature is

const springV = useSpringValue(0);

springV.onChange((v) => console.log(`val now be ${v}`));

Just like a to function but always request value and return nothing. And same for other events.

Why should this feature be included?

It can help to share a SpringValue to others by pass in props. Now, I can only add listener at useSpringValue.

Please provide an example for how this would work

Im trying to pass a SpringValue called seed (witch computed by mousemove) to Subcomponents, and each Subcomponents owned a SpringValue called ans.

Normally ans should be computed by seed (like using to instead a useSpringValue). But when I drag a Subcomponent, it must return to oraginal status and folow my dragging.

So I can only use .set and .start in to function to set seed value to ans and put return on a fake animad.div.

@1216892614 1216892614 added the template: request is a request someone has submitted label Sep 23, 2024
@1216892614
Copy link
Author

How my animation look like

output.mp4

@1216892614
Copy link
Author

And TBH, I use useSpringValue much much more than useSpring or others. I do think SpringValue should be the major hero feature, not useSpirng.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
template: request is a request someone has submitted
Projects
None yet
Development

No branches or pull requests

1 participant