Skip to content

Commit

Permalink
Erlenmeyer flask example
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonsturges committed Nov 9, 2024
1 parent 2448154 commit 623492c
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions examples/models/science/erlenmeyer-flask.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!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 { centerMesh, ErlenmeyerFlask } from "../../../src/index.js";
import { createOrbitScene } from "../../utils/orbitScene.js";

const { scene } = createOrbitScene();

const params = {
flaskRadius: 1,
neckRadius: 0.3,
height: 2.5,
neckHeight: 1,
radialSegments: 16,
};

let flask = new ErlenmeyerFlask(params);
scene.add(flask);
centerMesh(flask);

const gui = new GUI();
gui.title("Erlenmeyer Flask");
gui.add(params, "flaskRadius", 0.1, 2).name("Flask Radius").step(0.01).onChange(update);
gui.add(params, "neckRadius", 0.1, 2).name("Neck Radius").step(0.01).onChange(update);
gui.add(params, "height", 0.1, 5).name("Height").step(0.01).onChange(update);
gui.add(params, "neckHeight", 0.1, 5).name("Neck Height").step(0.01).onChange(update);
gui.add(params, "radialSegments", 3, 64).name("Radial Segments").step(1).onChange(update);

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

0 comments on commit 623492c

Please sign in to comment.