JavaScriptによるAPI活用
deviceorientationイベントとdevicemotionイベントの違いに関する説明として正しいものはどれか。
- Adeviceorientationイベントは加速度センサーの値のみを提供し、devicemotionイベントはコンパス方位のみを提供する。
- ✓deviceorientationイベントは端末の向き(コンパス方位や傾きを示すalpha・beta・gamma)の情報を提供し、devicemotionイベントは加速度や回転速度など動きに関する情報を提供する。
- C両イベントは全く同じ情報を提供するが、イベント名が異なるだけである。
- Ddevicemotionイベントはタッチ操作時にのみ発火し、deviceorientationイベントは常時発火する。
解説
deviceorientationイベントはDeviceOrientationEventを通じて端末の向き(方角や傾き)の情報を提供し、devicemotionイベントはDeviceMotionEventを通じて移動加速度や回転速度といった動きに関する情報を提供する点で役割が異なる。
根拠シラバス2.7.2 DeviceOrientation Event:deviceorientationイベント、devicemotionイベント