4.9.1.6 clamp - clamp( min, max, parameter )

The clamp function truncates the parameter argument if it is lower as the min argument and higher as the max argument. This means that you can define a value range for the returned value. We show this by using a sine function as the parameter argument and -1 as min argument and 1 as max argument.

sphere.YPosition = camp( -1, 1, sin( time * 90 ) * 2 );

this will cut off all values of the wave that are beyond a range between -1 and 1.

Since the clamp function cuts off all values beyond the specified value range the amplitude of the wave function gets truncated.

The red curve represents the values of the parameter argument. The blue curve represents the output of the clamp function.

We can define any value range for the clamp. To shift the range enter new values for the min and max arguments. Here we used -0.5 and 1.5

Xpressionist 3.5