Skip to content

Instantly share code, notes, and snippets.

@donmccurdy
Created November 29, 2017 16:46
Show Gist options
  • Save donmccurdy/c08977da5148651f05a9aa4080cead04 to your computer and use it in GitHub Desktop.
Save donmccurdy/c08977da5148651f05a9aa4080cead04 to your computer and use it in GitHub Desktop.
Missing api docs for dat.gui.

Table of Contents

interpret

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

toString

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

toString

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Parameters

  • color
  • forceCSSHex

tmpComponent

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Controller

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

domElement

Those who extend this class will put their DOM elements in here.

object

The object to manipulate

property

The name of the property to manipulate

onChange

Specify that a function fire every time someone changes the value with this Controller.

Parameters

  • fnc Function This function will be called whenever the value is modified via this Controller.

Returns Controller this

onFinishChange

Specify that a function fire every time someone "finishes" changing the value wih this Controller. Useful for values that change incrementally like numbers or strings.

Parameters

  • fnc Function This function will be called whenever someone "finishes" changing the value via this Controller.

Returns Controller this

setValue

Change the value of object[property]

Parameters

  • newValue Object The new value of object[property]

getValue

Gets the value of object[property]

Returns Object The current value of object[property]

updateDisplay

Refreshes the visual display of a Controller in order to keep sync with the object's current value.

Returns Controller this

isModified

Returns Boolean true if the value has deviated from initialValue

Controller

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

domElement

Those who extend this class will put their DOM elements in here.

object

The object to manipulate

property

The name of the property to manipulate

onChange

Specify that a function fire every time someone changes the value with this Controller.

Parameters

  • fnc Function This function will be called whenever the value is modified via this Controller.

Returns Controller this

onFinishChange

Specify that a function fire every time someone "finishes" changing the value wih this Controller. Useful for values that change incrementally like numbers or strings.

Parameters

  • fnc Function This function will be called whenever someone "finishes" changing the value via this Controller.

Returns Controller this

setValue

Change the value of object[property]

Parameters

  • newValue Object The new value of object[property]

getValue

Gets the value of object[property]

Returns Object The current value of object[property]

updateDisplay

Refreshes the visual display of a Controller in order to keep sync with the object's current value.

Returns Controller this

isModified

Returns Boolean true if the value has deviated from initialValue

Controller

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Parameters

  • object
  • property

domElement

Those who extend this class will put their DOM elements in here.

object

The object to manipulate

property

The name of the property to manipulate

onChange

Specify that a function fire every time someone changes the value with this Controller.

Parameters

  • fnc Function This function will be called whenever the value is modified via this Controller.

Returns Controller this

onFinishChange

Specify that a function fire every time someone "finishes" changing the value wih this Controller. Useful for values that change incrementally like numbers or strings.

Parameters

  • fnc Function This function will be called whenever someone "finishes" changing the value via this Controller.

Returns Controller this

setValue

Change the value of object[property]

Parameters

  • newValue Object The new value of object[property]

getValue

Gets the value of object[property]

Returns Object The current value of object[property]

updateDisplay

Refreshes the visual display of a Controller in order to keep sync with the object's current value.

Returns Controller this

isModified

Returns Boolean true if the value has deviated from initialValue

Controller

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

domElement

Those who extend this class will put their DOM elements in here.

object

The object to manipulate

property

The name of the property to manipulate

onChange

Specify that a function fire every time someone changes the value with this Controller.

Parameters

  • fnc Function This function will be called whenever the value is modified via this Controller.

Returns Controller this

onFinishChange

Specify that a function fire every time someone "finishes" changing the value wih this Controller. Useful for values that change incrementally like numbers or strings.

Parameters

  • fnc Function This function will be called whenever someone "finishes" changing the value via this Controller.

Returns Controller this

setValue

Change the value of object[property]

Parameters

  • newValue Object The new value of object[property]

getValue

Gets the value of object[property]

Returns Object The current value of object[property]

updateDisplay

Refreshes the visual display of a Controller in order to keep sync with the object's current value.

Returns Controller this

isModified

Returns Boolean true if the value has deviated from initialValue

Controller

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

domElement

Those who extend this class will put their DOM elements in here.

object

The object to manipulate

property

The name of the property to manipulate

onChange

Specify that a function fire every time someone changes the value with this Controller.

Parameters

  • fnc Function This function will be called whenever the value is modified via this Controller.

Returns Controller this

onFinishChange

Specify that a function fire every time someone "finishes" changing the value wih this Controller. Useful for values that change incrementally like numbers or strings.

Parameters

  • fnc Function This function will be called whenever someone "finishes" changing the value via this Controller.

Returns Controller this

setValue

Change the value of object[property]

Parameters

  • newValue Object The new value of object[property]

getValue

Gets the value of object[property]

Returns Object The current value of object[property]

updateDisplay

Refreshes the visual display of a Controller in order to keep sync with the object's current value.

Returns Controller this

isModified

Returns Boolean true if the value has deviated from initialValue

Controller

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

domElement

Those who extend this class will put their DOM elements in here.

object

The object to manipulate

property

The name of the property to manipulate

onChange

Specify that a function fire every time someone changes the value with this Controller.

Parameters

  • fnc Function This function will be called whenever the value is modified via this Controller.

Returns Controller this

onFinishChange

Specify that a function fire every time someone "finishes" changing the value wih this Controller. Useful for values that change incrementally like numbers or strings.

Parameters

  • fnc Function This function will be called whenever someone "finishes" changing the value via this Controller.

Returns Controller this

setValue

Change the value of object[property]

Parameters

  • newValue Object The new value of object[property]

getValue

Gets the value of object[property]

Returns Object The current value of object[property]

updateDisplay

Refreshes the visual display of a Controller in order to keep sync with the object's current value.

Returns Controller this

isModified

Returns Boolean true if the value has deviated from initialValue

Controller

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

domElement

Those who extend this class will put their DOM elements in here.

object

The object to manipulate

property

The name of the property to manipulate

onChange

Specify that a function fire every time someone changes the value with this Controller.

Parameters

  • fnc Function This function will be called whenever the value is modified via this Controller.

Returns Controller this

onFinishChange

Specify that a function fire every time someone "finishes" changing the value wih this Controller. Useful for values that change incrementally like numbers or strings.

Parameters

  • fnc Function This function will be called whenever someone "finishes" changing the value via this Controller.

Returns Controller this

setValue

Change the value of object[property]

Parameters

  • newValue Object The new value of object[property]

getValue

Gets the value of object[property]

Returns Object The current value of object[property]

updateDisplay

Refreshes the visual display of a Controller in order to keep sync with the object's current value.

Returns Controller this

isModified

Returns Boolean true if the value has deviated from initialValue

dat.controllers

Extends dat.controllers.Controller

Parameters

  • object Object The object to be manipulated
  • property string The name of the property to be manipulated

dat.controllers

Parameters

  • object Object The object to be manipulated
  • property string The name of the property to be manipulated

dat.controllers

Extends dat.controllers.Controller

Parameters

  • object Object The object to be manipulated
  • property string The name of the property to be manipulated

dat.controllers

Extends dat.controllers.Controller

Parameters

  • object Object The object to be manipulated
  • property string The name of the property to be manipulated
  • params Object? Optional parameters
    • params.min Number? Minimum allowed value
    • params.max Number? Maximum allowed value
    • params.step Number? Increment by which to change value

dat.controllers

Extends dat.controllers.Controller, dat.controllers.NumberController

Parameters

  • object Object The object to be manipulated
  • property string The name of the property to be manipulated
  • params Object? Optional parameters
    • params.min Number? Minimum allowed value
    • params.max Number? Maximum allowed value
    • params.step Number? Increment by which to change value

dat.controllers

Extends dat.controllers.Controller, dat.controllers.NumberController

Parameters

  • object Object The object to be manipulated
  • property string The name of the property to be manipulated
  • minValue Number Minimum allowed value
  • maxValue Number Maximum allowed value
  • stepValue Number Increment by which to change value

dat.controllers

Extends dat.controllers.Controller

Parameters

  • object Object The object to be manipulated
  • property string The name of the property to be manipulated
  • options (Object | Array<string>) A map of labels to acceptable values, or a list of acceptable string values.

dat.controllers

Extends dat.controllers.Controller

Parameters

  • object Object The object to be manipulated
  • property string The name of the property to be manipulated

OptionController

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

NumberController

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

min

Specify a minimum value for object[property].

Parameters

  • v
  • minValue Number The minimum value for object[property]

Returns dat.controllers.NumberController this

max

Specify a maximum value for object[property].

Parameters

  • v
  • maxValue Number The maximum value for object[property]

Returns dat.controllers.NumberController this

step

Specify a step value that dat.controllers.NumberController increments by.

Parameters

  • v
  • stepValue Number The step value for dat.controllers.NumberController

Returns dat.controllers.NumberController this

NumberController

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

min

Specify a minimum value for object[property].

Parameters

  • v
  • minValue Number The minimum value for object[property]

Returns dat.controllers.NumberController this

max

Specify a maximum value for object[property].

Parameters

  • v
  • maxValue Number The maximum value for object[property]

Returns dat.controllers.NumberController this

step

Specify a step value that dat.controllers.NumberController increments by.

Parameters

  • v
  • stepValue Number The step value for dat.controllers.NumberController

Returns dat.controllers.NumberController this

dom

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

makeSelectable

Parameters

  • elem
  • selectable

makeFullscreen

Parameters

  • elem
  • hor
  • vert
  • horizontal

fakeEvent

Parameters

  • elem
  • eventType
  • pars
  • aux
  • params

bind

Parameters

  • elem
  • event
  • func
  • newBool
  • bool

unbind

Parameters

  • elem
  • event
  • func
  • newBool
  • bool

addClass

Parameters

  • elem
  • className

removeClass

Parameters

  • elem
  • className

getWidth

Parameters

  • elem

getHeight

Parameters

  • elem

getOffset

Parameters

  • el

isActive

Parameters

  • elem

hide

Hide centered div

common

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

dat.dom

css

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

css

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

CSS_NAMESPACE

Outer-most className for GUI's

Type: string

CLOSE_BUTTON_HEIGHT

The only value shared between the JS and SCSS. Use caution.

Type: number

autoPlaceVirgin

Have we yet to create an autoPlace GUI?

autoPlaceContainer

Fixed position div that auto place GUI's go inside

hide

Are we hiding the GUI's ?

hideableGuis

GUI's which should be hidden

dat.gui

A lightweight controller library for JavaScript. It allows you to easily manipulate variables and fire functions on the fly.

Parameters

  • params Object?
    • params.name String? The name of this GUI.
    • params.load Object? JSON object representing the saved state of this GUI.
    • params.auto Boolean (optional, default true)
    • params.parent dat.gui.GUI? The GUI I'm nested in.
    • params.closed Boolean? If true, starts closed
    • params.closeOnTop Boolean? If true, close/open button shows on top of the GUI

domElement

Outermost DOM Element

parent

The parent GUI

autoPlace

Handles GUI's element placement for you

closeOnTop

Handles GUI's position of open/close button

preset

The identifier for a set of saved values

width

The width of GUI element

name

The name of GUI. Used for folders. i.e a folder's name

closed

Whether the GUI is collapsed or not

load

Contains all presets

useLocalStorage

Determines whether or not to use localStorage as the means for remembering

add

Parameters

  • object
  • property

Returns dat.controllers.Controller The new controller that was added.

addColor

Parameters

  • object
  • property

Returns dat.controllers.ColorController The new controller that was added.

remove

Parameters

  • controller

addFolder

Parameters

  • name

  • Throws Error if this GUI already has a folder by the specified name

Returns dat.gui.GUI The new folder.

remember

Mark objects for saving. The order of these objects cannot change as the GUI grows. When remembering new objects, append them to the end of the list.

  • Throws Error if not called on a top level GUI.

getRoot

Returns dat.gui.GUI the topmost parent GUI of a nested GUI.

getSaveObject

Returns Object a JSON object representing the current state of this GUI as well as its remembered properties.

addRow

Add a row to the end of the GUI or before another row.

Parameters

  • gui
  • newDom If specified, inserts the dom content in the new row
  • liBefore If specified, places the new row before another row

Color

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

ARR_EACH

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Common

Band-aid methods for things that should be a lot easier in JavaScript. Implementation and structure inspired by underscore.js http://documentcloud.github.com/underscore/

requestAnimationFrame

dat-gui JavaScript Controller Library http://code.google.com/p/dat-gui

Copyright 2011 Data Arts Team, Google Creative Lab

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Parameters

  • callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment