GODRICH
#css-animation#button#loader#transition#scroll#dashboard#ui#design-trends

07A Pointer Drag That Snaps Into a Cell on Release

Pressing and dragging a tile makes it follow along only the axis toward the blank and clamps it to one cell width. On release, if the offset passes SNAP_RATIO (0.5) it settles into the blank, otherwise it returns. One pointer event handles mouse and touch together.

Best forHow to implement a drag-and-release touch control

SNAP_RATIOpointerclamp
A Pointer Drag That Snaps Into a Cell on Release
Open in a new tab

07 A Pointer Drag That Snaps Into a Cell on Release — Measured area 12.728% · moving frames 19/23Original by GODRICH · SCSS and React ship in the zip · Sliding Puzzle: 9 Canvas Scenes, Parity to Search

The post this demo lives in

Sliding Puzzle: 9 Canvas Scenes, Parity to Search - preview of all 9 demosSliding Puzzle: 9 Canvas Scenes, Parity to SearchWhy are some sliding puzzle boards unsolvable? 02 counts flipped pairs to sort them, 05 raises a Manhattan distance boun See all demos in this post

If you like this effect - similar demos