Global Function

lerp()

Declaration

func lerp(startValue: Double, endValue: Double, t: Double) -> Double

Parameters

startValue
endValue
t

Returns

Double - interpolated value.

Description

Linear interpolation. Calculate a position between startValue and endValue given the value t. t is a number 0 to 1. 0 is at startValue, 1 is at endValue.

Examples

var a = lerp(startValue: 0.0, endValue: 100.0, t: 0.5)
// value of a is 50.0

Related

smoothstep()