Skip to content Skip to sidebar Skip to footer

P5-js Map() Function In Python

Is there a function like the map() of p5-js in python? the map() in python isn't the same at all, as I understood it, in python it apply same function to all the iterable in a sequ

Solution 1:

P5.js is open source, and you can view the source for the map() function here.

p5.prototype.map = function(n, start1, stop1, start2, stop2) {
  return ((n-start1)/(stop1-start1))*(stop2-start2)+start2;
};

Post a Comment for "P5-js Map() Function In Python"