View Full Version : Volume slider on the slide
macaroon
19th November 2001, 16:04
Is it possible to do a volume slider that is not on the horizontal, say at 45 degrees? I know it is for I have seen the future! The real question is this:
Would it be possible to script it as a thumb slider that travels along the 'volume path' as it were rather than a series of images.
If so, how on earth do you do? I draw pictures, me and am still awaiting a bigger brain for all the scripty stuff :eek:
Cheers
Spoonman
19th November 2001, 18:30
It's certainly possible to make diagonal sliders. However, you have to do it all with scripting. As in, when you detect the mouseover, you'd have to move the thumb image to the appropriate location. That's a theory BTW. All I've tried are vertical and circular sliders.
mikekantor
20th November 2001, 06:07
All you need is some creative math in the script.
It will probably involve some trig (sin, cos, tan). What you need to do is to represent the hypotenuse of the triangle as the volume, so you have the minimum at the bottom, and the max at the top.
When you get the volume, figure out what percent it is from the maximum, and multiply that by the pixel length of the hypotenuse. Once you have that, all you need are the x and y coordinates at that point. Assuming you are working from the bottom-left angle:
sin(angle)=y/h
cos(angle)=x/h
tan(angle)=y/x
Using just sin and cos, you can get the x and y values for where to place the thumb.
Lucas
20th November 2001, 15:12
You can use this stupid lib and all you need is 3 png and a few lines of code.
http://forums.winamp.com/showthread.php?s=&threadid=65440
-L
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.