Blogs / Personal blogs

Amit Patel

redblobgames.com

Interactive tutorials for math and algorithms

Popular posts
8
Total points
2,575
HN comments
835
Rank
#591 personal

Visit redblobgames.com → RSS feedOn Hacker News Oct 2014 – Sep 2026

Games & Graphics 6Math & Algorithms 4Design & UX 2Web & Frontend 1Software Engineering 1Life, Learning & Writing 1

1

Draggable objects

Many of my interactive pages have a draggable object . I want the reader to move the object around, and I want the diagram to respond in some way. Here I’ll document the code I use to make this work with both mouse and touch input, using browser features that are widely supported since 2020. Here’s a common case I…