let laSensor = new LinearAccelerationSensor({ frequency: 60 });
laSensor.addEventListener("reading", (e) => {
console.log(`Linear acceleration along the X-axis ${laSensor.x}`);
console.log(`Linear acceleration along the Y-axis ${laSensor.y}`);
console.log(`Linear acceleration along the Z-axis ${laSensor.z}`);
});
laSensor.start();LinearAccelerationSensor / notebook
LinearAccelerationSensor
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.