-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrolpanel.js
More file actions
46 lines (37 loc) · 851 Bytes
/
Copy pathcontrolpanel.js
File metadata and controls
46 lines (37 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class ControlPanel{
constructor(title){
this.name = title;
this.elements = [];
}
createPanel(){
createP(this.name);
}
refreshPanel(){
for(let element of this.elements){
element.p.html(element.text + element.slider.value());
}
}
addSlider(name,text,min,max,def,step){
this.elements.push(new Slider(name, text, min, max, def, step));
}
value(name){
return this.sliders[cp.index(name)].slider.value()
}
index(name){
let index;
for (let index = 0; index < this.elements.length; index++){
if (this.elements[index].name === name){
return index;
}
}
return -1;
}
}
class Slider{
constructor(name, text, min, max, def, step){
this.name = name;
this.text = text;
this.p = createP(text);
this.slider = createSlider(min,max,def,step);
}
}