Answers for "javascript scale values"

0

javascript scale values

function convertRange( value, r1, r2 ) { 
    return ( value - r1[ 0 ] ) * ( r2[ 1 ] - r2[ 0 ] ) / ( r1[ 1 ] - r1[ 0 ] ) + r2[ 0 ];
}

convertRange( 328.17, [ 300.77, 559.22 ], [ 1, 10 ] );

>>> 1.9541497388276272
Posted by: Guest on May-26-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language