Possible thanks to the Device Orientation Events.
Facebook’s Paper photo tilt feature in HTML5 →
photoTilt Demo →
photoTilt Source (GitHub) →
Did you know that this doesn’t work on a Retina MacBook Pro, but does on the previous MacBook Pro model? It’s the Sudden Motion Sensor which affords orientation detection, yet one cannot find that sensor inside a Retina MacBook Pro. Digging into Apple Support one reads that the SMS is “designed to help prevent disk issues if the computer is dropped or undergoes severe vibration”. As the MacBook Pro sports an SSD (instead of an HDD which benefits from the SMS) Apple have omitted the sensor from the Retina MacBook Pro.
Apple should put back the sensor; it has its uses (games, websites, etc.)