Created
September 23, 2011 08:36
-
-
Save neocoder/1236966 to your computer and use it in GitHub Desktop.
Logorithmic slider function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Thanks to STH - http://stackoverflow.com/users/56338/sth | |
function logslider(value) { | |
// value will be between 0 and 100 | |
var min = 0; | |
var max = 100; | |
// The result should be between 100 an 10000000 | |
var minv = Math.log(100); | |
var maxv = Math.log(10000000); | |
// calculate adjustment factor | |
var scale = (maxv-minv) / (max-min); | |
return Math.exp(minv + scale*(value-min)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment