Skip to main content
Version: 3.9.0

Lerp

lerp

Lerp, or Linear Interpolation, is a node that outputs a value along a specified range. The Start and Stop values determine the limits of the range and the Step value determines a point between them. Lerp is in the Math category.

Input

NameData TypeDescription
StartNumber, Vec2, Vec3, ColorStarting point.
StopNumber, Vec2, Vec3, ColorStopping point.
StepNumberThe value (from 0 to 1) used to interpolate between Start and Stop.

Output

NameData TypeDescription
ResultNumber, Vec2, Vec3, ColorA value between Start and Stop.

Example 1

This example uses a Lerp node to gradually change the color of a sphere from red to blue over four seconds. The Start value has been set to red and the Stop value has been set to blue. The Step value determines what point between the two colors the node should output (0.5 would output purple).

lerp node

Example 2

At times, you may want the Start or Stop value to track a moving object. In this next example, an image will move from the center of the screen to the 2D position of a face over the first two seconds after an effect starts. The Start value (not to be confused with the Start node) has been set to 0,0 (the center of the screen) and the Stop value follows the 2D position of a face.

tip

To pull the 2D position of a face, Get Position from a Face Sticker with the Anchor set to Face Center.

lerp node 2

Example 3

The Lerp node is a great tool for smoothing out a transition. This example shows how to smoothly track a cube to a user’s head. The Lerp node is outputting the current position of the cube. This value is then fed back into the node as the Start input so that every frame, the cube will be a set distance (0.1 in this example) between the Head Tracker and the cube’s previous position.

For this example, the Step value remains constant (the higher the number, the less of a delay there will be).

lerp node 3