Practical UI physics
Demos for my talk Practical UI physics.
Adding physics-based motion to UI can make digital interactions feel natural, comfortable, and delightful. So why is it so hard to get right, especially on the web? While mobile device SDK's have physics-based libraries built-in, web developers are missing a straight-forward way to add physics to their sites. This talk aims to solve that. Physics is a huge subject, and physics programming is often intimidating. But for UI developers, we need only to take advantage of its core principles in a practical model. This talk will cover the fundamentals of physics programming, how to develop your own physics model in JavaScript, and how to use that model to make UI feel natural.
Demos also available on CodePen โ Practial UI physics collection
- basic
- step graphs
- drag
- attraction
- attraction drag
- attraction conditional
- attraction two targets
- gravity well
- wind
- resting position
- rubber band bounds
- photo scroller
Demo use mouse events to keep code simple, even though I recommend using physics for touch-based devices. Yes, I realize the irony.
Additional resources
- Nature of Code by Daniel Shiffman, Chapters 1 & 2
- Coding Math videos on YouTube by Keith Peters