{{tag>proxy function}}
====== clamp() ======
Used to limit the minimum/maximum value of an expression. Useful for things that need to stop at a given value.
===== Expression =====
**clamp(input_value, lowest_value, highest_value)**
**input_value**
The value that you want to limit, can be a function. A universal input that will work in most cases is start_value +/- timeex() * speed
**lowest_value**
This is the lowest value that the function can output. This value is used instead of //input_value// when //input_value// is lower than //lowest_value//.
**highest_value**
This is the highest value that the function can output. This value is used instead of //input_value// when //input_value// is higher than //highest_value//.
===== Examples =====
==== Clamp ====
**clamp(5 + timeex(), 5, 10)**
----
When shown, the proxy starts at 5 and increases over time thanks to timeex(), clamp(input, %%min%%, %%max%%) is used to limit the output so the value never goes above 10.
==== Reverse Clamp ====
**clamp(10 - timeex(), 5, 10)**
----
Same as above except the proxy starts at 10 and decreases over time thanks to timeex(), clamp(input, %%min%%, %%max%%) is used to limit the output so the value never goes below 5.
===== Similar functions: =====
* min()
* max()
* modulo