5

There seem to be no onStartChange event in dat.gui, is there a simple workaround?

Ben Smith
  • 19,589
  • 6
  • 65
  • 93
arthur.sw
  • 11,052
  • 9
  • 47
  • 104
  • Did my answer help? Or do you have a problem with dat.GUI's onChange event? – Ben Smith Nov 10 '14 at 12:18
  • I knew about the onChange event, I was asking if there were a specific event fired only at the beginning of the change (actually, it was more a feature request I guess...). – arthur.sw Nov 10 '14 at 20:57

2 Answers2

3

You can use the onChange event. This is fired at the start of a change.

Ben Smith
  • 19,589
  • 6
  • 65
  • 93
0

If you are moving a scroller the onChange will update as the change is occurring. If you want it to only update after all changes then use .onFinishChange, here is an example below using onChange.

gui.add(options, "distance").min(1).max(300).step(1)
  .onChange(
    function(){
      yourVar = this.getValue();
    }
  )

The api docs are now located here onChange

JJWALLACE
  • 51
  • 9