smoothstep

 
 
 

Returns a value from 0 to 1 that represents a parameter’s proportional distance between a minimum and maximum value. The smoothstep function lets you increase an attribute such as Opacity from 0 to 1 gradually, but nonlinearly, over a time range.

The smoothstep function works like the linstep function, except it increases values more quickly near the middle values between the minimum and maximum value. The function uses hermite interpolation between minimum and maximum values.

float smoothstep(float start, float end, float parameter)

start and end specifies the minimum and maximum values.

parameter is the value you want to use to generate the smoothstep number.

If parameter is less than start, linstep returns 0.

If parameter is greater than end, linstep returns 1.

The following figure compares values returned by smoothstep and linstep over time:

Example

Suppose you’ve used the Particle Tool to create a collection of particles named Cloud:

Suppose also you’ve added a dynamic per object Opacity attribute to Cloud (see Work with particle attributes). You then write this runtime expression for Cloud’s particle shape node:

CloudShape.opacity = smoothstep(0,5,age);

This increases the Opacity attribute of CloudShape in steps from 0 to 1 for the first 5 seconds of the object’s age. This makes the object fade in from transparent to opaque. The fade in and fade out of the opacity occurs more quickly around 2.5, the midpoint between 0 and 5.

See the linstep function for details on similar examples.