On this page

# GUI

### new GUI(template)

Parameters:

Name | Type | Description
--- | --- | ---
`template` | Object | A set of name/object pairs, one per UI element

Source
  - GUI.js, line 6

Example

    const gui = new GUI ({
        opacity: { // slider
            val: [canvas.opacity, [0, 1, 0.1]],
            cmd: val => canvas.setOpacity(val),
        },
        download: { // button
            cmd: () => util.downloadBlob(data, 'data.json', false),
        },
        ...
    })

## Methods

### addUI(obj, key)

Parameters:

Name | Type | Description
--- | --- | ---
`obj` | Object | A gui object with two optional objects: 'val' and 'cmd'
`key` | string | The name of the gui

Source
  - GUI.js, line 72

Returns:

A dat.gui control object

Type anything to view search result