@tempots/std

interpolate() function

interpolate returns a value between a and b for any value of t (normally between 0 and 1).

Signature:

interpolate: (a: number, b: number, t: number) => number

Parameters

Parameter

Type

Description

a

number

The first value.

b

number

The second value.

t

number

The interpolation value.

Returns: number

The interpolated value.

Example

interpolate(0, 10, 0.5) // returns 5
interpolate(0, 10, 0.25) // returns 2.5
interpolate(0, 10, 0.75) // returns 7.5