Add working translation to sphere coordinates

This commit is contained in:
Paul Brinkmeier
2025-07-21 23:37:04 +02:00
parent 1635eb9ede
commit 26c35b27b4
7 changed files with 257 additions and 21 deletions
+17 -21
View File
@@ -1,26 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
table {
width: 100%;
table-layout: fixed;
}
</style>
</head>
<body>
<h1>Is it working?</h1>
<button id="perm">click me for permissions</button>
<div style="color: red" id="disp">lalala</div>
<script>
document.querySelector("#perm").addEventListener("click", e => {
const ac = new AudioContext();
const osc = ac.createOscillator();
osc.type = "square";
osc.frequency.setValueAtTime(440, ac.currentTime);
osc.connect(ac.destination);
osc.start();
DeviceMotionEvent.requestPermission().then(response => {
window.addEventListener("devicemotion", e => {
document.querySelector("#disp").innerHTML = Math.round(e.acceleration.x);
osc.frequency.setValueAtTime(440 * Math.pow(2, e.acceleration.x / 10), ac.currentTime);
});
});
});
</script>
<h1>Is it working?</h1>
<button id="perm">click me for permissions</button>
<canvas width="200" height="200" id="canvas"></canvas>
<script src="m3.js"></script>
<script src="util.js"></script>
<script src="v3.js"></script>
<script src="index.js"></script>
</body>
</html>