Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x=0
- function draw() {
- VSlider(75,80,240,100,1,x);
- }
- function VSlider(x, y, Lenght, Max, Steps,Value) {
- textSize(20);
- fill(150);
- stroke(0);
- strokeWeight(3);
- rect(x-5, y, 10, Lenght, 5);
- var valPos = map(Value, 0, 100, 100, 0)*(Lenght/Max)+x;
- fill(0);
- rect(x-12, valPos-5, 24, 10, 2);
- if (mouseX < x+12 && mouseX > x-12 && mouseY > valPos-5 && mouseY < valPos-5 && mouseIsPressed){
- Value=map(mouseY, y, y+Lenght, 100, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement