rgrannell1 / don-t-drop-me

Home Page:https://dont-drop-me.rgrannell2.now.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't Drop Me!

I've long felt my phone should scream if I drop it, so here's a PWA for that purpose.

Implementation

This is implemented using the devicemotion event. The device is represented as a point (x, y, z) in 3d space:

  • x: left to right in the plane of the screen
  • y: bottom to top in the plane of the screen
  • z: back to front perpendicular to the screen

The acceleration vector will be (0, 0, 0) when the device is at rest. Dropping it will transform this vector with a vector A = (ax, ay, az), with the magnitude ||A|| being ~9.81

To stop the audio triggering sporadically the app checks that a few samples (~150ms worth) indicate freefall simultaneously.

About

https://dont-drop-me.rgrannell2.now.sh/

License:MIT License


Languages

Language:JavaScript 86.3%Language:CSS 10.6%Language:HTML 3.2%