HUD Slider Class

The Heads Up Display Slider is a simple and transparent way to insert sliders into your Processing sketches. Just place the pde file inside your processing sketch and call the slider class for each slider you wish to create.

Download and place this .pde file inside your Processing sketch: HUD Slider Class
[Example applet]


Usage:

HUD h1,h2,h3; //create HUD slider objects

void setup(){
size(500, 500);

//slidername= new HUD( slidername, slider number, total number of sliders, slider size, color, strokeWeight);
h1= new HUD("h1",0,3,15,color(255,0,0),2);
h2= new HUD("h2",1,3,15,color(255,0,0),2);
h3= new HUD("h3",2,3,15,color(255,0,0),2);

ellipseMode(CENTER);
smooth();
noFill();
}

void draw(){
background(255);

h1.draw();
h2.draw();
h3.draw();

//nameofSlider.v gives the value of the slider at it’s current position
//values range from -1 to 1 so multiply with a number as needed
stroke(h1.v*255,120,0);
ellipse(width*1/6,width/3,h1.v*100,h1.v*100);

stroke(h2.v*255,120,0);
ellipse(width*3/6,width/3,h2.v*100,h2.v*100);

stroke(h3.v*255,120,0);
ellipse(width*5/6,width/3,h3.v*100,h3.v*100);
}