Lerp

Math
Both Server and Client
Both Mobile and PC

Linear interpolation, returns the value corresponding to the interpolation progress between the start value and the target value, the interpolation coefficient is [0,1]

Declaration

func Lerp(valueA float, valueB float, valueT float) float
go

Parameters

Input

Name Type Description
ValueA Float The starting value of linear interpolation. This value is returned when the interpolation progress is 0
ValueB Float The target value of linear interpolation. This value is returned when the interpolation progress is 1
ValueT Float Interpolation progress, the value range is [0,1]. When the value is 0, it returns the start value, when the value is 1, it returns the target value, and when the value is 0.5, it returns the average of the start value and the target value.

Return

Type Description
Float Linear interpolation return value