Skip to main content

MathUtils.lerp

Function

Linearly interpolate from floating-point a to b, based on fraction t (where t=0.0 returns a, and t=1.0 returns b).

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

lerp(a, b, time): number

Linearly interpolate from floating-point a to b, based on fraction t (where t=0.0 returns a, and t=1.0 returns b). This is equivalent to the vec2 and vec3 lerp() functions, but operates on scalar floating-point values.

Parameters

ParameterType
anumber
bnumber
timenumber

Returns

number