MIKHAIL NERI

Lab · Experiment

Shake to drop

Shake a phone and the pieces fall to the floor; shake again and they spring home.

TypeScript · DeviceMotion API · React 19

This experiment needs JavaScript and WebGL. The write up below describes what it does.

Notes

Background
On v2 a phone shake dropped every visible piece of the page to the bottom of the screen, and the site allowed motion sensors on every page to make it work.
How it works
Small physics with no engine: gravity, a bouncing floor with friction, walls and spin. A shake counts when several strong jolts land within 700 ms, with a cooldown so one shake toggles once. iOS asks for motion access, so the Run button is the tap that grants it. Here the pieces fall inside the plate, and a click stands in for a shake on desktop.
Now
Motion sensors are now allowed on this page only; every other page denies them.