2

Simple question is there a simple on/off button for three.js gui?

var params =
{
     switch: 0
};

// on/off button
gui.add(params, "light switch").min(0).max(1).step(1)

gui.open();

This is what I have so far, but you have to slide the value left or right, which is counter-intuitive. I just want the user to.be able to click on teh button switching it on and off.

Sort of like this:

three.js gui button

For all your invisible elephant needs.

Ghoul Fool
  • 6,249
  • 10
  • 67
  • 125

1 Answers1

2

If you want to add a checkbox to your GUI, you only have to define switch as a boolean.

var params = {
    switch: false
};

gui.add(params, "switch").name("light switch");
gui.open();
Mugen87
  • 28,829
  • 4
  • 27
  • 50