← Back

ofxSurfingRandomizer

github.com/moebiussurfing/ofxSurfingRandomizer · @moebiussurfing
OF 0.12 Releases Utilities GUI

Randomizer explorer between minimum and maximum ranges for ofParameters and int index with probabilities.

0 0 Last commit 8mo ago Created 5y ago

README

ofxSurfingRandomizer



Overview

An openFrameworks add-on to perform Two types of useful Randomizers for your scenes.



The Randomizers will target over:

A. The desired ofParameters (int/float/bool) of an ofParameterGroup.

B. An Index selector. (_int/preset/state..._)

Why ?





A. ofParameters RANDOMIZER

USAGE

1. Just pass your ``ofParameterGroup` parameters container. 2. Enable the desired parameters from the group. 3. Set the range limits for each parameter to fit the random inside them. 4. Notice that limits will be also inside the Min/Max of the parameters but independent of them. 5. Trig the randomization. 6. Use the Tester player to repeat randomizations during tweaking.

B. Iindex RANDOMIZER

USAGE

1. Initialize the Min-Max of your index/int parameter. (ie: how many presets/states are available) 2. Set the probability for each index. 3. Set if the index should stay long or short staying duration when her random happens. 4. Set the global BPM clock speed. 5. Pass your ofParameter<int> target index to receive the index randoms (in ofApp). 6. Use the Tester player to repeat randomizations during tweaking.

<details> <summary>Other Features</summary> <p>

</p> </details>

<details> <summary>Example Code</summary> <p>

ofApp.h
`.cpp

include "ofxSurfingRandomizer.h"



ofxSurfingRandomizer randomizer;

// A. Params ofParameterGroup params; // group container ofParameter<float> lineWidth; ofParameter<float> separation; ofParameter<float> speed; ofParameter<int> amount; ofParameter<int> shapeType;

// B. Index ofParameter<int> index{ "index", 0, 0, 8 }; ofEventListener listenerIndex;

ofApp.cpp
.cpp void ofApp::setup() { // A. Params params.setName("paramsGroup"); params.add(lineWidth.set("lineWidth", 0.5, 0.0, 1.0)); params.add(separation.set("separation", 50.0, 1.0, 100.0)); params.add(speed.set("speed", 0.5, 0.0, 1.0)); params.add(amount.set("amount", 1, 1, 10)); params.add(speed.set("shapeType", 0, 0, 3));

// Setup randomizer.setIndexPtr(index); // B -> Must be setted before call setup. randomizer.setup(params); // A

// B. Index // Lambda callback to receive the randomized index target. //-------------------------------------------------------------- listenerIndex = index.newListener([this](int &i) { ofLogNotice("ofApp") << "Index: " << index; }); }
` </p> </details>

<details> <summary>Dependencies</summary> <p>

Clone these add-ons and include into the OF PROJECT GENERATOR: ofxSurfingHelpers ofxImGui. / _FORK_ from @Daandelange ofxImGuiSurfing ofxSurfingUndoHelper / _Optional. Disabled by default._ ofxWindowApp. / _Not required. Only for some examples._ Already included into
/libs`. No need to add manually into PG. ofxScaleDragRect / _Fork_ ofxMSAInteractiveObject / _Fork_ ofxUndo / _Optional. Disabled by default._

</p> </details>

<details> <summary>Tested Systems</summary> <p>

</p> </details>

<details> <summary>TODO</summary> <p>

Add more types: 2D/3D vectors and colors. Using templates [?] </p> </details>

Author

An add-on by @moebiusSurfing
( ManuMolina ) 2021*

Get this addon

HTTPS
SSH

Latest release

v0.1 published 5y ago