interface: set charge magnitude
This commit is contained in:
parent
642d1c5cdd
commit
be6d6ba000
2 changed files with 19 additions and 2 deletions
14
index.html
14
index.html
|
@ -68,10 +68,16 @@ aside > container > div {
|
||||||
<body>
|
<body>
|
||||||
<aside class="js">
|
<aside class="js">
|
||||||
<container>
|
<container>
|
||||||
<div style="width:100%">
|
<div>
|
||||||
<button onclick="toggle_physics()">Physics</button>
|
<button onclick="toggle_physics()">Physics</button>
|
||||||
<input id="checkbox-physics" type="checkbox" disabled>
|
<input id="checkbox-physics" type="checkbox" disabled>
|
||||||
</div>
|
</div>
|
||||||
|
<form style="display:grid;grid-template-columns:1fr auto;gap:5px;">
|
||||||
|
<input id="input-charge" type="range" min="-1.5" max="1.5" step="0.25"
|
||||||
|
style="min-width:100px;max-width:128px;"
|
||||||
|
oninput="set_charge(-Math.pow(10, input_charge.valueAsNumber))">
|
||||||
|
<input type="reset">
|
||||||
|
</form>
|
||||||
<div>
|
<div>
|
||||||
<button onclick="toggle_skeleton()">Skeleton</button>
|
<button onclick="toggle_skeleton()">Skeleton</button>
|
||||||
<input id="checkbox-skeleton" type="checkbox" disabled>
|
<input id="checkbox-skeleton" type="checkbox" disabled>
|
||||||
|
@ -108,6 +114,10 @@ Source code: <a href="https://git.atomic.garden/root/sphere-electrons">https://g
|
||||||
</noscript>
|
</noscript>
|
||||||
<script src="thomson-problem.js"></script>
|
<script src="thomson-problem.js"></script>
|
||||||
<script src="sketch.js"></script>
|
<script src="sketch.js"></script>
|
||||||
<script>document.querySelectorAll(".js").forEach(e => e.style = "display:initial");</script>
|
<script>
|
||||||
|
document.querySelectorAll(".js").forEach(e => e.style = "display:initial");
|
||||||
|
const input_charge = document.getElementById("input-charge");
|
||||||
|
input_charge.oninput();
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -319,3 +319,10 @@ function toggle_polytope() {
|
||||||
polytope = !polytope;
|
polytope = !polytope;
|
||||||
checkbox_polytope.checked = polytope;
|
checkbox_polytope.checked = polytope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_charge(value) {
|
||||||
|
charge = value;
|
||||||
|
for (let particle of particles) {
|
||||||
|
particle.charge = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue