Map function in JavaScript

| | Comments (0) | TrackBacks (0)

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

,

0 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

About this Entry

This page contains a single entry by Alex published on September 21, 2008 1:25 PM

GTD FAIL was the previous entry in this blog.

Decompressing and Renaming Tiff images is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.