dataarts / dat.gui

Lightweight controller library for JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I find out what parameters a specified function takes?

daiedy opened this issue · comments

image
Please add parameters and what this function should return to the documentation

I believe the fcn's arg is just the controllers value.

  gui.add(controller, 'width', 100, 1000, 25).onChange(width => {
        view.setWidth(width)
  })

Oh, and many times with an onChange, you really don't care about the actual controller.width value, you only want to call a function with that value like above.

A sneaky trick is to just have a one-parameter "controller" that is not used elsewhere:

    gui.add({ width: 700 }, 'width', 100, 1000, 25).onChange(val => {
         view.setWidth(val)
    })