dat.GUI 是一个轻量级的图形用户界面库(GUI 组件),使用这个库可以很容易地创建出能够改变代码变量的界面组件。
<script type="text/javascript" src="../libs/dat.gui.js">script>
var controls = new function () {
this.rotationSpeed = 0.02;
//......
};
var gui = new dat.GUI();
gui.add(controls, 'rotationSpeed', 0, 0.5);
//......
上述原文出自:www.hangge.com 原文链接:https://www.hangge.com/blog/cache/detail_1785.html
GUI: ƒ GUI(pars)
color: {math: {…}, Color: ƒ, interpret: ƒ}
controllers: {Controller: ƒ, BooleanController: ƒ, OptionController: ƒ, StringController: ƒ, NumberController: ƒ, …}
default: {color: {…}, controllers: {…}, dom: {…}, gui: {…}, GUI: ƒ}
dom: {dom: {…}}
gui: {GUI: ƒ}
.domElement
.autoPlace: true
.closeOnTop: false
.closed: false
.load: Object
.name: undefined
.parent: undefined
.preset: "Default"
.scrollable: true
.useLocalStorage: false
.width: 245
.add(object, property)
添加控制器
.addColor(object, property)
添加颜色控制器
.addFolder(name)
添加文件夹
.close()
关闭
.destroy()
删除
.getRoot()
获取根节点
.getSaveObject()
.hide()
隐藏
.listen(controller)
.onResize()
.onResizeDebounced: ƒ ()
.open()
打开
.remember()
.remove(controller)
移除控制器
.removeFolder(folder)
移除文件夹
.revert(gui)
.save()
.saveAs(presetName)
.show()
显示
.updateDisplay()
更新显示内容
.initialValue = object[property];
.domElement = document.createElement('div');
.object = object;
.property = property;
.getValue()
.isModified()
.onChange(fnc)
.onFinishChange(fnc)
.setValue(newValue)
.updateDisplay()