arthur.sw
arthur.sw

Reputation: 11619

On start change event in dat.gui

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

Upvotes: 5

Views: 3977

Answers (2)

Ben Smith
Ben Smith

Reputation: 20230

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

Upvotes: 3

JJWALLACE
JJWALLACE

Reputation: 61

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

Upvotes: 0

Related Questions