Map function in JavaScript
While building out my new lifestream, I ran into a wall, and needed a function to map a variable from one coordinate space (specifically arrays). I remembered that Proce55ing had just such a function. OpenSource Software FTW!
function map(value, istart, istop, ostart, ostop) {
return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));}
Categories
code , programming0 TrackBacks
Listed below are links to blogs that reference this entry: Map function in JavaScript.
TrackBack URL for this entry: http://hyperradiant.net/MT-4/mt-tb.cgi/231

Leave a comment