Skip to content

Use of framer motion to move poker card into pile #60

Answered by aod
zhibin-wang09 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, appreciate your interest! It's been quite a while since I've last wrote code for this project. But I remember it being quite simple. I took a look at the Card component and think I found it:

layoutId={props.card?.toString()}

The prop layoutId on a motion component enables this feature.
When you play a card it is removed from the Hand component, re-rendered without that card and rendered instead in the Pile component.
I don't know the technical details on how Framer Motion transitions the element. But I do know that using that prop animates out the old component and transitions it to the new component's place.

Let…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zhibin-wang09
Comment options

Answer selected by zhibin-wang09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants