feat(card): apply the tilt hover effect on the single-user page (#64)#66
Merged
Merged
Conversation
The FUT-style lean-and-shine already used on the Versus page is a big part of the card's feel, and the single-user page is the more visited of the two. Reuse the existing TiltCard rather than duplicating the physics, wrapping the capture container instead of the card itself: renderCardImage clones the captureRef subtree, so keeping the hover glass a sibling of that node ensures it can never appear in the exported PNG.
Contributor
Author
|
Closing this one - I could not verify the hover behaviour in a running browser on my side, and I would rather not land a visual change I have only reasoned about statically. Happy to leave #64 open for someone who can check it end to end. Thanks! |
Owner
|
@eeshsaxena I checked it in the browser across the result page, hover feels right. |
Contributor
Author
|
Sorry for closing this, it was closed by mistake during a cleanup. The PR looks good from my side, happy for it to be reviewed and merged whenever convenient. |
Owner
|
@eeshsaxena Im merging this now, thank you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #64.
What
The Versus page wraps its card in
TiltCard(the lean-toward-the-cursor plus specular sweep), but the single-user page - the more visited of the two - renders a barePlayerCard. This applies the same effect there.It reuses the existing
TiltCardrather than duplicating the physics, and passes the samemaskSrc={resolveCardTheme(card).bg}thatDuelViewuses, so the shine is clipped to the card's silhouette instead of painting a rectangle.The one non-obvious bit: where the wrapper goes
TiltCardwraps the capture container, not the card:renderCardImagedoesnode.cloneNode(true)oncaptureRef.current, so it exports exactly that subtree. Wrapping outsidecaptureRefkeepsTiltCard's hover-glass overlay a sibling of the captured node, so it can never end up in the downloaded or copied PNG. Wrapping inside (aroundPlayerCardalone) would have put the overlay into the export.The tilt transform is likewise applied to the parent, and
renderCardImagere-anchors the clone at the viewport origin, so it does not affect the exported image either.FlagPickerstays outsidecaptureRefexactly as before.Verification
npx tsc --noEmitclean;npm run lint0 errors;npx vitest rungreen (20 files, 217 tests).captureRefsubtree is cloned, and the hover glass sits outside it.An AI assistant helped implement this; I reviewed the change and ran the typecheck, linter and tests locally.