3 ms·
> especially on the web where it's quite nice to just be allowed to make your design react to device motion without having to ask. What kinds of motions and re
by nemetroid 5y ago
> especially on the web where it's quite nice to just be allowed to make your design react to device motion without having to ask.
What kinds of motions and reactions would that be, beyond rotations (which are a much higher-level API than raw accelerometer data)?
- afavour 5y agoThe web has a DeviceMotion API that provides such higher level data: https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotio... Originally it wasn’t behind a permission prompt so you could do the little design flourishes the OP described. But now you have to request access. Orientation change events (i.e. portrait to landscape) remains accessible without permissions, though.
- nemetroid 5y ago> the little design flourishes the OP described And what flourishes are those?
- afavour 5y agoAn example I’ve seen (I forget where but hey, it won’t work now anyway) is to move some background elements to create a parallax effect, like iOS itself does: https://www.idownloadblog.com/2013/06/28/ios-7-parallax-effect-explained/ https://www.idownloadblog.com/2013/06/28/ios-7-parallax-effe... I’m not trying to make out that it’s a crucial feature or anything but it’s a useful case study in permission gating things: it’s small enough that you’d never trigger a permission prompt to ask to do it, so you just don’t instead, and lose a class of nice subtle design flourish.
- Pulcinella 5y agoJust FYI for anyone wondering: I believe this parallax effect specifically uses the UIMotionEffect API. It’s designed to be a simple and straightforward way to implement these kinds of effects without the developer having to worry about cleaning up the raw, noisey motion data. It has a few limitations/features. I don’t think it necessarily always runs at the screen refresh rate. It will also “self level” after a while. So if the user rotates their device and this causes a UI effect, if they hold their phone still the effect will reset after a few seconds. https://developer.apple.com/documentation/uikit/uimotioneffect/ https://developer.apple.com/documentation/uikit/uimotioneffe...
- jonplackett 5y agoNot talking about raw data. Clearly that isn’t needed for the web. But my point is that it got thrown out with the bath water.