Created
December 3, 2023 06:06
-
-
Save simulationguest/8495082a760e2db7c2ade26bb5a0f900 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
let gyro = new Gyroscope({ frequency: 60 }); | |
let x = 0, | |
y = 0, | |
z = 0; | |
gyro.addEventListener("reading", () => { | |
x += gyro.x; | |
y += gyro.y; | |
z += gyro.z; | |
}); | |
gyro.start(); | |
</script> | |
<p>X: {x} | Y: {y} | Z: {z}</p> | |
<div class="container"> | |
<div class="surface" style="--x:{x}deg;--y:{y}deg;--z:{z}deg"></div> | |
</div> | |
<style> | |
:global(body) { | |
background: #111; | |
overflow-x: hidden; | |
} | |
* { | |
font-family: sans-serif; | |
} | |
p { | |
color: white; | |
} | |
.container { | |
width: 100%; | |
height: calc(100vh - 100px); | |
display: grid; | |
perspective: 1000px; | |
perspective-origin: 50% 50%; | |
place-items: center; | |
} | |
.surface { | |
transform: rotateX(var(--x)) rotateY(var(--y)) rotateZ(var(--z)); | |
background: linear-gradient(to bottom, #333, #aaa); | |
width: 80%; | |
height: 80%; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ÇØPYRIGHT LEOPOLD SCHLOFER