Skip to content

Commit

Permalink
UI: add GUI Z rotation speed controller
Browse files Browse the repository at this point in the history
  • Loading branch information
leccelecce committed Aug 17, 2024
1 parent d3f8788 commit 790ff41
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ var trackingSpheres = [];
var pulse = 1;
var pulseValue = 0.005;

var zRotationSpeed = 0.002;

const bloomParams = {
threshold: 0,
strength: 0.95,
Expand All @@ -25,6 +27,7 @@ const bloomParams = {
};

const effectController = {
zRotationSpeed: 0.002,
showNodes: true,
refreshNodes: function () {
fetch("/api/nodes")
Expand Down Expand Up @@ -416,9 +419,14 @@ function doGuiSetup() {
}
};

const rotationChanger = function () {
zRotationSpeed = effectController.zRotationSpeed;
};

// see https://lil-gui.georgealways.com/#
const gui = new GUI({ title: 'Settings' });

gui.add(effectController, 'zRotationSpeed', 0, 0.01, 0.001 ).onChange(rotationChanger);
gui.add(effectController, 'showNodes', true).onChange(nodeChanger);
gui.add(effectController, 'refreshNodes');

Expand Down Expand Up @@ -455,7 +463,7 @@ function render() {
pulseValue = 0.005;
}

groupPivot.rotation.z += 0.002;
groupPivot.rotation.z += zRotationSpeed;

controls.update();

Expand Down

0 comments on commit 790ff41

Please sign in to comment.