Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a mechanism to expose params to dat.GUI #3

Open
OmarShehata opened this issue Dec 27, 2021 · 0 comments
Open

Add a mechanism to expose params to dat.GUI #3

OmarShehata opened this issue Dec 27, 2021 · 0 comments

Comments

@OmarShehata
Copy link
Owner

In the original entwined you can add this line of code that will expose a parameter to the GUI:

final BasicParameter speedParam = new BasicParameter("Speed", defaultValue, min, max);

That creates a slider you can change at runtime. And then you can get its value with:

speedParam.getValue()

It would be nice to do something similar here. It should be pretty easy using dat.gui. You would need to:

  1. Update PatternBase.js to give all patterns some new addParameter function
  2. PatternBase will also need access to the dat.gui instance which is created in LoadPatterns.js. This may be best to refactor. Maybe the gui instance should be created in index.js, and then passed to the patterns in this line:
/// You would change this to (cubes, model, gui)
patternInstance = new patternModule.default(cubes, model);

The addParameter function should just create a slider to start out with.

  1. There should also be a getValue(paramName) function that patterns can use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant