You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (dispose ||!hasEventListener(EVENT_DEVICE_ORIENTATION)) {
159
+
_gyroscopeStream?.cancel();
160
+
_gyroscopeStream =null;
161
+
}
162
+
}
163
+
164
+
/// Convert gyroscope data obtained in Flutter into rotation angle in the Web
165
+
/// In the w3c standard:
166
+
/// alpha: A number representing the motion of the device around the z axis, express in degrees with values ranging from 0 (inclusive) to 360 (exclusive).
167
+
/// beta: A number representing the motion of the device around the x axis, expressed in degrees with values ranging from -180 (inclusive) to 180 (exclusive).
168
+
/// gamma: A number representing the motion of the device around the y axis, expressed in degrees with values ranging from -90 (inclusive) to 90 (exclusive).
169
+
voiddispatchDeviceOrientationEvent(x, y, z) {
170
+
var xAxisAngle= math.atan2(y, z) * (180/ math.pi); // 绕X轴的旋转角度
171
+
var yAxisAngle = math.atan2(-x, math.sqrt(y * y + z * z)) * (180/ math.pi); // 绕Y轴的旋转角度
172
+
var zAxisAngle = math.atan2(y, z) * (180/ math.pi); // 绕Z轴的旋转角度
0 commit comments