Linear Interpolation (LERP) returns a value between two others at a point of linear scale.

Rotation = From + (To - From) × Amount

Input:

  • From: The value to transition from.
  • To: The value to transition to.
  • Amount: How far to transition.

Output:

  • Rotation: The value between the From and To input, at a linear scale (defined by Amount input).

Example

The most common use case is to smoothly transition from one rotation to another.

Every frame, the block rotates 5% (0.05) of the way from its initial rotation (0°) towards its goal (90°). Note that it doesn't rotate on a constant speed, it's because by every frame, the From input changes itself to be the block's current rotation, which means the distance between From and To get's smaller, therefore 5% of the way towards its goal is smaller than what it was in the previous frames.