Most swipe gesture code looks like this: if (deltaX > 100) { triggerSwipe(); } Clean. Readable. And completely broken in real use. Why? Because it only tracks distance. And distance can't tell the difference between a slow, uncertain drag and a sharp, intentional flick. The fix is one line: const velocity = (currentX - lastX) / (currentTime - lastTime); That's a derivative. dx/dt. High school calculus. Once you add velocity, everything changes: → Quick flick, short distance? Trigger it. The user meant it. → Slow drag, long distance? Let it snap back. They were just exploring. I wrote about this, how the gap between a gesture that feels native and one that feels broken isn't some framework magic. It's just math. Link in comments 👇 #frontend #webdev #javascript #react #ux #gestures
interesting
https://medium.com/@kedardeshmukh/swipe-is-just-calculus-building-natural-gesture-systems-with-derivatives-81022734cffc