Is it possible to create a button using dat.gui

不问归期 提交于 2020-01-23 04:38:11

问题


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");

回答1:


This creates a button with text left aligned.

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

gui.add(obj,'add');



回答2:


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



来源:https://stackoverflow.com/questions/18366229/is-it-possible-to-create-a-button-using-dat-gui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!