control p5 how to create multiple sliders from a class?
in
Contributed Library Questions
•
1 month ago
Hi,
I woud like to create 24 sliders using some of the same information and so i would like to use a class to store the information and float things like the x and y position and add these in like a normal class but i can't seem to get it to work... Here is the code i am trying to use which i know works:
c1=new ControlP5(this);
c1.addSlider ("channel1")
.setPosition(10,100)
.setSize(80,400)
.setRange(0,255)
.setSliderMode(Slider.FLEXIBLE)
.setSliderBarSize(20);
c1.setColorBackground(#3109D3);
c1.setColorForeground(#4DB3FF);
c1.setColorActive(#A0E6FF);
c1.setColorLabel(#000000);
c1.hide();
I would like to change this in a class to the following so i can type say, slider("channel 1", xpos,ypos) but something so that it would also recall all of the other information, is this possible? it would tidy up my code massively if it is :-).
c1=new ControlP5(this);
c1.addSlider (
name)
.setPosition(
xpos,ypos)
.setSize(80,400)
.setRange(0,255)
.setSliderMode(Slider.FLEXIBLE)
.setSliderBarSize(20);
c1.setColorBackground(#3109D3);
c1.setColorForeground(#4DB3FF);
c1.setColorActive(#A0E6FF);
c1.setColorLabel(#000000);
c1.hide();
1