Reference lerp()

lerp()

Calculates a number between two numbers at a specific increment.

The amt parameter is the amount to interpolate between the two numbers. 0.0 is equal to the first number, 0.1 is very near the first number, 0.5 is half-way in between, and 1.0 is equal to the second number. The lerp() function is convenient for creating motion along a straight path and for drawing dotted lines.

If the value of amt is less than 0 or more than 1, lerp() will return a number outside of the original interval. For example, calling lerp(0, 10, 1.5) will return 15.

Examples

Syntax

lerp(start, stop, amt)

Parameters

start
Number:

first value.

stop
Number:

second value.

amt
Number:

number.

Returns

Number: lerped value.
This page is generated from the comments in src/math/calculation.js . Please feel free to edit it and submit a pull request!

Related References