dataarts / dat.guiVR

A flexible graphical user interface for changing variables within WebVR.
https://workshop.chromeexperiments.com/examples/guiVR/
Apache License 2.0
311 stars 50 forks source link

implement "listen" on controls #20

Closed customlogic closed 8 years ago

customlogic commented 8 years ago

The original dat.GUI had an optional "listen" function that tells the control to update the value it's displaying in case the app changes the value somewhere else.

listen() example from dat.GUI

For example, in the torus sample, we should turn listen "on" for the many of the controls so that when you press "reset", all the sliders, buttons and drop downs update to reflect their new values.

dat.GUI does it by creating an array of controls that are actively "listening". If there is more than one controller in the array, it runs an internal requestAnimationFrame loop, checking for changes every frame.

mflux commented 8 years ago

Completed with 210a05b077fe2ca994eeac35aa749ab541422a1e

Check out example listen.html