Skip to content

Commit

Permalink
Panel light example
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonsturges committed Nov 17, 2024
1 parent b387f81 commit 667c4e7
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-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>
<li><a href="/three-low-poly/models/science/tesla-coil">Tesla Coil</a></li>
Expand Down
48 changes: 48 additions & 0 deletions examples/models/science/panel-light.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 { PanelLight, centerMesh } from "../../../src/index.js";
import { createOrbitScene } from "../../utils/orbitScene.js";

const { scene } = createOrbitScene();

const gui = new GUI();

const params = {
color: 0xffc7c7,
emissive: 0xff0000,
emissiveIntensity: 0.5,
};

let panelLight = new PanelLight(params);
scene.add(panelLight);
centerMesh(panelLight);

gui.addColor(params, "color").name("Color").onChange(update);
gui.addColor(params, "emissive").name("Emissive").onChange(update);
gui.add(params, "emissiveIntensity", 0, 1, 0.001).name("Emissive Intensity").onChange(update);

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

0 comments on commit 667c4e7

Please sign in to comment.