48 lines
1.4 KiB
HTML
48 lines
1.4 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>Simple Space Demo</title>
|
|
<style>
|
|
html,
|
|
body {
|
|
margin: 0;
|
|
height: 100%;
|
|
}
|
|
folk-transformed-space {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
folk-shape {
|
|
background: rgb(134, 37, 37);
|
|
border: 1px solid rgba(0, 0, 0, 0.5);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<folk-gizmos></folk-gizmos>
|
|
<folk-transformed-space>
|
|
<folk-gizmos layer="transformed"></folk-gizmos>
|
|
<folk-shape x="250" y="100" width="50" height="50"></folk-shape>
|
|
<folk-shape x="200" y="200" width="75" height="75" rotation="90"></folk-shape>
|
|
<folk-shape x="50" y="250" width="25" height="25" rotation="180"></folk-shape>
|
|
<folk-shape x="350" y="50" width="100" height="100" rotation="270"></folk-shape>
|
|
<folk-shape x="500" y="500" width="150" height="150" rotation="360"></folk-shape>
|
|
</folk-transformed-space>
|
|
|
|
<script type="module">
|
|
import '@labs/standalone/folk-transformed-space.ts';
|
|
import '@labs/standalone/folk-shape.ts';
|
|
|
|
const space = document.querySelector('folk-transformed-space');
|
|
document.addEventListener('click', (event) => {
|
|
if (event.target !== space) return;
|
|
const min = 20;
|
|
const max = 70;
|
|
const randomRotation = Math.random() * (max - min) + min;
|
|
space.rotate(randomRotation);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|