タグ

ブックマーク / blog.alt-scape.com (2)

  • iPhone(iOS4.2)の加速度センサーとジャイロセンサーの値をJavascriptで取得する | alt

    去年の暮れにリリースされた「iOS4.2」から WEBブラウザ(Safari)で加速度センサー、ジャイロセンサーのAPIにアクセスできるようになりました。 せっかくiPhone持っているんだし、試しにそれぞれの値をブラウザに出力してみます。 センサー値の取得はJavascriptのイベントにて行います。 まずiPhoneの傾きが変化するとdevicemotionというイベントが発生するので window.addEventListenerで感知し、 関数に渡されるイベントオブジェクトのプロパティよりそれぞれの値を取得します。 別でdeviceorientationというイベントがありますが、 こちらでも回転の加速度のみ取得が可能です。 ・傾きの加速度は、accelerationオブジェクト。 (xが左~右、yが手前~奥、zが上~下) ・傾きの重力加速度は、acceler

    goroyung
    goroyung 2012/09/27
  • alt-scape.com

    alt-scape.com 2019 Copyright. All Rights Reserved. The Sponsored Listings displayed above are served automatically by a third party. Neither the service provider nor the domain owner maintain any relationship with the advertisers. In case of trademark issues please contact the domain owner directly (contact information can be found in whois). Privacy Policy

  • 1