Is it possible to create a button using dat.gui

后端 未结 2 1658
余生分开走
余生分开走 2021-02-18 18:13

I would like to create a button using dat.gui library. In a perfect world, this would work like this:

gui.add(\"button\", \"click me\");
相关标签:
2条回答
  • 2021-02-18 18:24

    This creates a button with text left aligned.

    var obj = { add:function(){ console.log("clicked") }};
    
    gui.add(obj,'add');
    
    0 讨论(0)
  • 2021-02-18 18:25

    FWIW, dat.gui assumes the GUI type based on the target's initial value type.

    • boolean => checkbox
    • int/float => slider
    • string => text input
    • function => button

    Examples can be found here: http://workshop.chromeexperiments.com/examples/gui/#1--Basic-Usage

    0 讨论(0)
提交回复
热议问题