Map

The map() function converts a value from one range to another. In this example, map converts the cursor’s horizontal position from a range of 0-720 to 0-360. The resulting value become the circle’s hue. Map also converts the cursor’s vertical position from a range of 0-400 to 20-300. The resulting value becomes the circle’s diameter.

Contributors: Caleb Foss

Modified from Map.

Originally ported from the Processing example Map.

Map is licensed under CC BY-NC-SA 4.0.