Advertisement
Guest User

Untitled

a guest
Jan 6th, 2018
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. x=0
  2.  
  3. function draw() {
  4.     VSlider(75,80,240,100,1,x);
  5.         }
  6.  
  7. function VSlider(x, y, Lenght, Max, Steps,Value) {
  8.     textSize(20);
  9.     fill(150);
  10.     stroke(0);
  11.     strokeWeight(3);
  12.     rect(x-5, y, 10, Lenght, 5);
  13.    
  14.     var valPos = map(Value, 0, 100, 100, 0)*(Lenght/Max)+x;
  15.     fill(0);
  16.     rect(x-12, valPos-5, 24, 10, 2);
  17.    
  18.     if (mouseX < x+12 && mouseX > x-12 && mouseY > valPos-5 && mouseY < valPos-5 && mouseIsPressed){
  19.         Value=map(mouseY, y, y+Lenght, 100, 0);
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement