From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- files/zh-tw/web/api/devicemotionevent/index.html | 116 +++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 files/zh-tw/web/api/devicemotionevent/index.html (limited to 'files/zh-tw/web/api/devicemotionevent') diff --git a/files/zh-tw/web/api/devicemotionevent/index.html b/files/zh-tw/web/api/devicemotionevent/index.html new file mode 100644 index 0000000000..f21723a1e3 --- /dev/null +++ b/files/zh-tw/web/api/devicemotionevent/index.html @@ -0,0 +1,116 @@ +--- +title: DeviceMotionEvent +slug: Web/API/DeviceMotionEvent +translation_of: Web/API/DeviceMotionEvent +--- +

{{apiref("Device Orientation Events")}}{{SeeCompatTable}}

+ +

概要

+ +

DeviceMotionEvent 提供了網頁開發者關於裝置位置及旋轉方向改變時的速度資訊。

+ +
+

Warning: Currently, Firefox and Chrome does not handle the coordinates the same way. Take care about this while using them.

+
+ +

屬性

+ +
+
{{domxref("DeviceMotionEvent.acceleration")}} {{readonlyinline}}
+
An object giving the acceleration of the device on the three axis X, Y and Z. Acceleration is expressed in m/s2.
+
{{domxref("DeviceMotionEvent.accelerationIncludingGravity")}} {{readonlyinline}}
+
An object giving the acceleration of the device on the three axis X, Y and Z with the effect of gravity. Acceleration is expressed in m/s2.
+
{{domxref("DeviceMotionEvent.rotationRate")}} {{readonlyinline}}
+
An object giving the rate of change of the device's orientation on the three orientation axis alpha, beta and gamma. Rotation rate is express in degrees per seconds.
+
{{domxref("DeviceMotionEvent.interval")}} {{readonlyinline}}
+
A number representing the interval of time, in milliseconds, at which data is obtained from the device.
+
+ +

範例

+ +
window.addEventListener('devicemotion', function(event) {
+  console.log(event.acceleration.x + ' m/s2');
+});
+ +

規範

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('Device Orientation')}}{{Spec2('Device Orientation')}}Initial specification.
+ +

瀏覽器相容性

+ +

{{ CompatibilityTable() }}

+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{ CompatVersionUnknown() }}{{CompatVersionUnknown}}{{CompatGeckoDesktop("6")}}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support{{ CompatVersionUnknown() }}{{CompatVersionUnknown}}{{CompatGeckoMobile("6")}}{{ CompatNo() }}{{ CompatNo() }}4.2
+
+ +

參見

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