118 lines
3.2 KiB
HTML
118 lines
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Falling Sand Demo</title>
|
|
<style>
|
|
html {
|
|
height: 100%;
|
|
}
|
|
|
|
body {
|
|
min-height: 100%;
|
|
position: relative;
|
|
margin: 0;
|
|
overscroll-behavior: none;
|
|
}
|
|
|
|
folk-shape {
|
|
position: absolute;
|
|
background-color: rgba(119, 119, 119, 1);
|
|
border-radius: 2px;
|
|
|
|
&:has(iframe) {
|
|
background: transparent;
|
|
}
|
|
}
|
|
|
|
key-helper {
|
|
position: fixed;
|
|
top: 20px;
|
|
right: 20px;
|
|
background: rgba(0, 0, 0, 0.7);
|
|
color: white;
|
|
padding: 10px;
|
|
border-radius: 5px;
|
|
font-family: monospace;
|
|
z-index: 1000;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 5px;
|
|
|
|
button {
|
|
all: unset;
|
|
|
|
&[active] key-number {
|
|
background: rgba(255, 255, 255, 0.6);
|
|
}
|
|
|
|
key-number {
|
|
display: inline-block;
|
|
background: rgba(255, 255, 255, 0.2);
|
|
padding: 2px 8px;
|
|
border-radius: 3px;
|
|
margin-right: 10px;
|
|
}
|
|
}
|
|
}
|
|
|
|
p {
|
|
box-sizing: border-box;
|
|
color: white;
|
|
position: absolute;
|
|
top: 150px;
|
|
left: 25px;
|
|
border: 1px solid white;
|
|
}
|
|
|
|
iframe {
|
|
border: unset;
|
|
width: 100%;
|
|
height: 100%;
|
|
/* margins cause infinite resize loops */
|
|
box-sizing: border-box;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<key-helper>
|
|
<button><key-number>1</key-number> Smoke</button>
|
|
<button><key-number>2</key-number> Water</button>
|
|
<button><key-number>3</key-number> Lava</button>
|
|
<button active><key-number>4</key-number> Sand</button>
|
|
<button><key-number>5</key-number> Plant</button>
|
|
<button><key-number>6</key-number> Stone</button>
|
|
<button><key-number>7</key-number> Wall</button>
|
|
<button><key-number>8</key-number> Ice</button>
|
|
<button><key-number>9</key-number> Fire</button>
|
|
</key-helper>
|
|
|
|
<folk-sand sources="folk-shape:not(:has(iframe)), iframe folk-shape">
|
|
<p>Sanding</p>
|
|
</folk-sand>
|
|
|
|
<folk-shape x="10" y="100" width="250" height="400">
|
|
<iframe src="./sticky-html-arrow.html"></iframe>
|
|
</folk-shape>
|
|
|
|
<folk-shape x="300" y="100" width="250" height="400">
|
|
<iframe id="frame2" src="./sticky-html-arrow.html"></iframe>
|
|
</folk-shape>
|
|
|
|
<folk-shape x="400" y="250" width="60" height="90"></folk-shape>
|
|
<folk-shape x="200" y="400" width="100" height="100"></folk-shape>
|
|
<folk-shape x="500" y="100" width="30" height="70"></folk-shape>
|
|
|
|
<script type="module">
|
|
import '@labs/standalone/folk-shape.ts';
|
|
import '@labs/standalone/folk-sand.ts';
|
|
|
|
document.querySelector('folk-sand').onMaterialChange = (materialNumber) => {
|
|
document.querySelector('key-helper button[active]').removeAttribute('active');
|
|
document.querySelector(`key-helper button:nth-child(${materialNumber})`).setAttribute('active', '');
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|