From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/api/window/devicemotion_event/index.html | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 files/ja/web/api/window/devicemotion_event/index.html (limited to 'files/ja/web/api/window/devicemotion_event') diff --git a/files/ja/web/api/window/devicemotion_event/index.html b/files/ja/web/api/window/devicemotion_event/index.html new file mode 100644 index 0000000000..e17af6d8b2 --- /dev/null +++ b/files/ja/web/api/window/devicemotion_event/index.html @@ -0,0 +1,78 @@ +--- +title: 'Window: devicemotion イベント' +slug: Web/API/Window/devicemotion_event +tags: + - API + - Device Orientation API + - Sensors + - events +translation_of: Web/API/Window/devicemotion_event +--- +

{{APIRef}}

+ +

devicemotion イベントは、一定の間隔で発行され、その時点で端末が受けている加速度の物理的な力の量を示します。また、利用可能であれば、回転率に関する情報も提供します。

+ + + + + + + + + + + + + + + + + + + + +
バブリングいいえ
キャンセル不可
インターフェイス{{domxref("DeviceMotionEvent")}}
イベントハンドラープロパティ{{domxref("Window.ondevicemotion")}}
+ +

+ +
function handleMotionEvent(event) {
+
+    var x = event.accelerationIncludingGravity.x;
+    var y = event.accelerationIncludingGravity.y;
+    var z = event.accelerationIncludingGravity.z;
+
+    // Do something awesome.
+}
+
+window.addEventListener("devicemotion", handleMotionEvent, true);
+
+ +

仕様書

+ + + + + + + + + + + + + + +
仕様書状態
{{SpecName("Device Orientation", "#devicemotion", "DeviceMotion event")}}{{Spec2("Device Orientation")}}
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.Window.devicemotion_event")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf