All examples

Swipe deck

Drag the top card. Past the threshold it flies away; otherwise it springs back.

dragInputuseAnimatedListenerAnimated.div

Preparing the example…

How it works

  1. dragInput writes the drag into x and y. settle chooses the resting place from the projected release position.
  2. Rotation and the Keep and Skip stamps are interpolations of the same x value.
  3. useAnimatedListener removes the card from state once it is off screen.
  4. The cards underneath are Animated.div elements whose pose depends on their depth, so they rise into place when the top card leaves.

More examples

Search

Type to search the documentation.