ably / giveitalob

A fun realtime demo - see how high you can throw your phone
1 stars 3 forks source link

Now I want to Calculate how height I can throw my phone use HTML5 #1

Closed Zhang-Yida closed 8 years ago

Zhang-Yida commented 8 years ago

I want to know how to calculate how height I can throw with HTML5 devicemotion? Could you give some help with some code from you github project? Thanks first!

mattheworiordan commented 8 years ago

So you just need to look at the code :)

Height detection is based on how long it's been in freefall, see https://github.com/ably/giveitalob/blob/main/client/flyer/projection.js#L12-L30

Freefall detection is a bit more complicated, see https://github.com/ably/giveitalob/blob/main/client/flyer.js#L191-L310