Skip to content

Commit

Permalink
Panel example
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonsturges committed Nov 17, 2024
1 parent 2b6228c commit 14e3163
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ <h2>Models</h2>
<li><a href="/three-low-poly/models/science/lever-panel">Lever Panel</a></li>
<li><a href="/three-low-poly/models/science/microscope">Microscope</a></li>
<li><a href="/three-low-poly/models/science/mortar-and-pestle">Mortar and Pestle</a></li>
<li><a href="/three-low-poly/models/science/panel">Panel</a></li>
<li><a href="/three-low-poly/models/science/panel-light">Panel Light</a></li>
<li><a href="/three-low-poly/models/science/spiral-tube">Spiral Tube</a></li>
<li><a href="/three-low-poly/models/science/stand">Stand</a></li>
Expand Down
48 changes: 48 additions & 0 deletions examples/models/science/panel.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Three Low Poly</title>
<style>
body {
margin: 0;
}
canvas {
display: block;
}
</style>
</head>
<body>
<script type="module">
import GUI from "lil-gui";
import { Panel, centerMesh } from "../../../src/index.js";
import { createOrbitScene } from "../../utils/orbitScene.js";

const { scene } = createOrbitScene();

const gui = new GUI();

const params = {
width: 3,
height: 4,
depth: 0.1,
};

let panel = new Panel(params);
scene.add(panel);
centerMesh(panel);

gui.add(params, "width", 0, 5, 0.001).name("Width").onChange(update);
gui.add(params, "height", 0, 5, 0.001).name("Height").onChange(update);
gui.add(params, "depth", 0, 2, 0.001).name("Depth").onChange(update);

function update() {
scene.remove(panel);
panel = new Panel(params);
scene.add(panel);
centerMesh(panel);
}
</script>
</body>
</html>

0 comments on commit 14e3163

Please sign in to comment.