Swipe cards look simple until you try to make them feel right. A release that jumps, an overlay that flickers when you drag diagonally, an undo that arrives from nowhere. I rebuilt the swipe stack in Bump from scratch and extracted it as an open-source package, craft_kit. This post walks through three decisions that made it feel good, and one bug that only showed up on the web.
Outline
The problem: what usually goes wrong (jitter, flicker, bolted-on undo).
Spring physics done right: every move starts from current position and velocity; closed-form springs so a slow frame never distorts motion.
Judging a release by where the card is heading: projected position instead of distance only.
Per-direction behaviors: a small table instead of nested ifs; code sample.
The genie: capture the card as a picture, warp a mesh toward a point with an eased, lagged funnel; reverse it for undo.
The web bug: on CanvasKit, ImageShader.dispose() also disposes the image it was given, which broke undo. How I found it with a self-test, and the fix.
Try it: demo link, 3-line start, whatβs next.



Top comments (0)