I recently experimented with using dat.GUI in a specific three.js example.
To integrate a GUI for adjusting mesh opacity, I made the following code modifications.
var loader=new THREE.VTKLoader();
loader.load ("models/vtk/bunny.vtk", function(geom){
var mesh = new THREE.Mesh(geom, material );
mesh.doubleSided=true;
mesh.position.setY(-0.09);
scene.add( mesh );
var gui = new dat.GUI();
var view = this;
view.Opacity = 0.2;
var maingui = gui.addFolder('Main');
var opacity = maingui.add(view, 'Opacity', 0, 1);
opacity.onChange( function(value) {
mesh.material.opacity = value;
});
maingui.open();
animate();
However, I encountered an issue where after clicking on the opacity slider, my mouse became stuck following the slider without being able to release it.