Skip to content

feat(swipe-deck): add elastic wobble, bounce-back and smaller card - #315

Merged
starc007 merged 1 commit into
mainfrom
feat/swipe-deck-elastic
Dec 4, 2026
Merged

starc007 merged 1 commit into
mainfrom
feat/swipe-deck-elastic

Conversation

@starc007

@starc007 starc007 commented Dec 4, 2026

Copy link
Copy Markdown
Owner

What

Makes Swipe Deck feel springy and elastic, closer to the Before/After slider, and makes the card smaller.

  • Elastic tilt: the card's tilt follows the drag on an underdamped spring (WOBBLE), so it lags a little and wobbles when you stop or change direction.
  • Shear: fast drags slant the card up to 7deg against the motion, from useVelocity(x). The half you're not holding trails behind, then springs straight.
  • Vertical rubber band: the drag writes raw x and y through _dragX/_dragY. The drawn y is rubber-banded and capped at 90px, so pulling up or down resists more the further you go.
  • Bounce-back: a card let go early, or brought back with undo, returns on SPRING_BACK and overshoots the center once before settling.
  • Smaller card: 240px wide by default (max-w-60, was 320px), with smaller Like/Pass stamps and preview text.
  • About copy updated to describe the wobble and bounce, including the reduced motion paragraph.

Notes for review

  • Reduced motion turns off the tilt, shear, bounce and rubber band. The card still follows the pointer.
  • The bounce is on transforms only (x, y, rotate, skew). The depth scale of the cards behind doesn't overshoot.
  • The new springs are named local constants with comments, since this tuning is specific to this component.

Checks

  • bun run check and the a11y tests pass.
  • In the browser, with scripted pointer events: a card let go at 75px overshoots to -12px and settles in about 1.1s; a 160px vertical pull draws as 44px; a fast flick still throws the card.
  • Reduced motion not checked by hand.

@starc007
starc007 merged commit 8b9aa9b into main Dec 4, 2026
1 check passed
@starc007
starc007 deleted the feat/swipe-deck-elastic branch December 4, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant