3 ms·
I was showing this to a friend a couple of years ago when we accidentally discovered, to our delight, that it's orientation-aware. If you're using Chrome on a M
by peterjmag 13y ago
I was showing this to a friend a couple of years ago when we accidentally discovered, to our delight, that it's orientation-aware. If you're using Chrome on a Mac laptop, try tilting your machine to see how it affects the elements on screen. (Theoretically, it should also work on most iOS devices and other laptops with motion sensors, but I haven't really tested it extensively.)
Prior to that discovery, I had no idea that a non-mobile browser could access motion sensor data. Turns out that on a MBP at least, the data comes from the Sudden Motion Sensor[1], which is also responsible for parking disk drive heads if you drop your laptop. Pretty cool stuff.
[1] https://en.wikipedia.org/wiki/Sudden_Motion_Sensor https://en.wikipedia.org/wiki/Sudden_Motion_Sensor
A couple more links for the curious:
http://www.html5rocks.com/en/tutorials/device/orientation/ http://www.html5rocks.com/en/tutorials/device/orientation/
https://developer.mozilla.org/en-US/docs/WebAPI/Detecting_device_orientation https://developer.mozilla.org/en-US/docs/WebAPI/Detecting_de...
EDIT: Almost forgot, but I actually created a little drawing experiment based on this: http://peterjmags.com/accelosketch/ http://peterjmags.com/accelosketch/. Try clicking around and tilting your laptop to draw.
- dekhn 13y agoiOS didn't always expose device orientation events in javascript browser. In particular, one of the first apps I wrote, for iPhone 3GS, specifically could not be a browser app for this reason. Objective C is a hell of a programming language to learn just to access motion sensors.
- zackmorris 13y agoAnd for anything else devices do that could have been done in a browser.. Nothing like that sinking feeling in the pit of your stomach when you realize you have yet another memory leak, zombie object or mysterious exception in the main run loop to debug!
- peterjmag 13y agoYep, looks like it wasn't introduced until iOS 4.2: http://www.sitepoint.com/websockets-and-deviceorientation-support-in-ios-4-2/ http://www.sitepoint.com/websockets-and-deviceorientation-su...
- ogig 13y agoIt's also 'window speed aware', if you move/shake the browser window you will notice it.