loading code fetching the highlighted snippet
drag() makes the knob draggable on x and keeps it inside its track. Reset animates the knob home with animate(); both work on the same x value, so the next drag starts from wherever the knob is.
axis: 'x' locks the knob to one axis and sets touch-action: pan-y, so a vertical swipe on a phone still scrolls the
page.constraints: track keeps the knob inside the track element. Release it with
some speed and it glides, then settles against the edge.drag() and animate() share the knob's x, so
Reset springs it home and the next drag continues from where it is.Motion 14.10 lets drag() write into x/y motion values instead of moving the element. The dial stays where it is; a horizontal drag turns it, and a flick spins it with momentum.
drag(dial, { axis: 'x', x }) writes the drag into x, not the dial's own transform, so the dial never moves.x.on('change') turns the value into the dial's rotate.
Release with some speed and momentum keeps writing to x, so the dial
spins down.