I'm using dat.gui to control values but want to add a button to randomise the value. Is there a way to do this? I have the randomise button but I cannot figure out how to reference the parameter to change its value.
Basic code is something like:
const params = {}
params.num = 20
gui.add(params, 'num').onChange(doSomething)
//on clicking the 'Randomise' button I would essentially like this to happen:
gui.(params, 'num').setValue( randomValue ).onChange(doSomething)
Is there some way I can reference the parameter, and then set its value to x? Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire