Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = effect("Slider Control")("Slider").value;
- // add one zeros, and make it an unsigned string -- we'll add the negative back later if it's supposed to be negative
- nScaled = Math.abs(Math.round(n * 10));
- s = "" + nScaled.toString();
- // pad low values with leading zeros to ensure at least 2 digits after we move the decimal point
- while (s.length < 2) s = "0" + s;
- // if it was negative, add the - sign back
- if (n<0) s = "-" + s;
- // insert the decimal place before the last decimal place
- s = s.substr(0,s.length-1) + "." + s.substr(s.length-1,s.length)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement