fixed random oscillator mode

This commit is contained in:
2022-06-23 02:16:55 +02:00
parent e2b94e116d
commit baeea26410
5 changed files with 98 additions and 55 deletions

View File

@@ -92,7 +92,7 @@ public class SecondApplet extends PApplet {
pos = pos_;
params = params_;
for (int i = 0; i < params.size(); i++) {
slider.add(new Slider(10, 10+20*i+pos*75, 230, 12, params.get(i).minValue, params.get(i).maxValue, params.get(i).name, params.get(i).type)); //add possible waves to slider
slider.add(new Slider(10, 10+20*i+pos*75, 230, 12, params.get(i).minValue, params.get(i).maxValue, params.get(i).name, params.get(i).type, params.get(i).osciModes)); //add possible waves to slider
}
}
@@ -121,12 +121,13 @@ public class SecondApplet extends PApplet {
class Slider {
int x, y, w, h, mode;
int[] osciModes;
float minVal, maxVal, value; //should be private but doesnt work lol
boolean hovering, hovering_anim_btn, animated, randomized;
String label;
Oscillator osci;
Slider(int x_, int y_, int w_, int h_, float minVal_, float maxVal_, String label_, int mode_) {
Slider(int x_, int y_, int w_, int h_, float minVal_, float maxVal_, String label_, int mode_, int[] osciModes_) {
x = x_;
y = y_;
w = w_;
@@ -135,8 +136,9 @@ public class SecondApplet extends PApplet {
maxVal = maxVal_;
mode = mode_;
label = label_ + (mode == INTVAL ? " (INT)" : " (FLOAT)");
osci = new Oscillator(int(random(2, 20)));
osciModes = osciModes_;
osci = new Oscillator(int(random(2, 20)), osciModes);
osci.amplitude(minVal, maxVal);
animated = true;