Skip to content

GUI (THREE.JS plugin)

Logan Waldman edited this page Jan 11, 2016 · 6 revisions

GUI is a plugin to make THREE.JS overlays easy.

to begin :

var gui;
function init() {
  //...
  gui = new GUI.guiScene();
  gui.addTextElement("Hello World",0,0);
  //...
}
function animate() {
  //...
  gui.render(renderer);
  //...
}

fully working example @ https://git.io/vuDcx

This draws the text 'hello world' at the center of the screen. To extend the use further, you can call the gui.addElement() function, which adds the passed object to the gui. for example :

gui.addElement(new THREE.Object3D()).position.set(2,3,0);

while this may look confusing at first, it is actually quite simple. The function returns the object that was passed, so we can construct a new object in the params. Then we just move the object to it's new position (2,3).

##Cubes Wiki

##Gui.js Pages

Clone this wiki locally