Loading

Pnorm


processing
Since v1.0.0
Available on all platforms
See also

Normalizes a number from another range into a value between 0 and 1. Identical to value low high 0 1 Pmap.

Numbers outside of the range are not clamped to 0 and 1, because out-of-range values are often intentional and useful.

Link to original Processing doc

Signature

Examples

// @preview image 10 10 '2D' PGraphics 20 'value' STORE $value 0 50 Pnorm //returns 0.4 SWAP //put the PGraphics instance on top of the stack -10 'value' STORE $value 0 100 Pnorm // returns -0.1 SWAP DROP