Is it possible to create a button using dat.gui

2019-04-19 02:43发布

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条回答
手持菜刀,她持情操
2楼-- · 2019-04-19 03:11

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

查看更多
时光不老,我们不散
3楼-- · 2019-04-19 03:27

This creates a button with text left aligned.

var obj = { add:function(){ console.log("clicked") }};

gui.add(obj,'add');
查看更多
登录 后发表回答