dat.gui how to hide menu with code

后端 未结 7 958
太阳男子
太阳男子 2021-02-06 04:06

I made a menu using dat.gui for my applcation with Three.js. It works fine, I have also discovered that pressing h key I can hide the menu created with dat.gui. My question is h

7条回答
  •  星月不相逢
    2021-02-06 04:15

    What you and I were looking for is

    var gui = new dat.GUI();
    // to toggle it closed
    gui.closed = true;
    // to toggle it open again
    gui.closed = false;
    

    I got this from the source at line 2104 where the internal functions open and close are doing exactly this.

    The gui reacts to the value change on the fly (you can reassign gui.closed from the console to see it in action).

提交回复
热议问题