Skip to content
Advertisement

How to add folders in dat.gui?

I’m trying to add folders for a the lights in a three.js project that i copied from a three.js example. But i can’t get it working. I guess i should use f1=add.folder(‘light1’) and then somehow add the parameters to f1 with f1.add(‘intensity’) etc… but how to do this, when the code is structured like this ? node = f1.add() doesen’t work!

JavaScript

Advertisement

Answer

If you add the target (i.e. gui or the folder) as parameter to addGui it should work fine.

something like this:

JavaScript
Advertisement