Skip to content

what does the xys in config mean? #1545

Answered by joshuaellis
branlok asked this question in Support
Discussion options

You must be logged in to vote

xys is the name of an arbitrary prop in the useSpring hook in the form of an array. If you passed it directly to the animated component it wouldn't do anything because it doesn't relate to a css prop, hence why we interpolate the value: props.xys.to(trans), where trans is a function returning a string of CSS props:

const trans = (x, y, s) => `perspective(600px) rotateX(${x}deg) rotateY(${y}deg) scale(${s})`;

The example you've shared uses an old version of react-spring but i've updated it to the most up to date, see: https://codesandbox.io/s/tilt-card-with-react-spring-hooks-forked-cqx46?file=/src/index.js

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@branlok
Comment options

Answer selected by branlok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants