๐Ÿ“ฆ microsoft / playwright

๐Ÿ“„ device-motion.html ยท 29 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29<!DOCTYPE html>
<html lang="en">

<head>
  <title>Device motion test</title>
</head>

<body>
  <script>
    window.result = 'Was not moved';
    window.acceleration = undefined;
    window.accelerationIncludingGravity = undefined;
    window.rotationRate = undefined;
    window.interval = undefined;

    document.addEventListener('devicemotion', onMotion, false);

    function onMotion(event) {
      window.result = 'Moved';
      window.acceleration = event.acceleration;
      window.accelerationIncludingGravity = event.accelerationIncludingGravity;
      window.rotationRate = event.rotationRate;
      window.interval = event.interval;
    }
  </script>
</body>

</html>