You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useTrail uses useSprings under the hood and the - I believe - undocumented attach attribute to attach controllers from the first spring to the last. I think it would be useful to allow users specify which index should useTrail use as its origin.
In my situation, I needed slides to trail the dragged slide, which index can obviously vary. To make that happen, I reused the source code from useTrail and adapted to my needs. I'm not exactly sure what would be the best API for this though, possibly set({..., attachedIndex: index }). I'm also wondering if useTrail could also share the same set(i => ({...})) as useSprings.
We no longer use attach and we do allow a reverse prop. To pass a custom index is something we currently do not support, but it is something we could look at adding in the future.
🚀 Feature Proposal
useTrail
usesuseSprings
under the hood and the - I believe - undocumentedattach
attribute to attach controllers from the first spring to the last. I think it would be useful to allow users specify which index shoulduseTrail
use as its origin.Motivation
I made a small carousel lib with staggered animation: https://github.com/dbismut/react-soft-slider
In my situation, I needed slides to trail the dragged slide, which index can obviously vary. To make that happen, I reused the source code from
useTrail
and adapted to my needs. I'm not exactly sure what would be the best API for this though, possiblyset({..., attachedIndex: index })
. I'm also wondering ifuseTrail
could also share the sameset(i => ({...}))
asuseSprings
.Example
Heavily inspired from the example on
react-use-gesture
: https://codesandbox.io/s/nwj6597vq4The text was updated successfully, but these errors were encountered: