UKismetMathLibrary::Lerp
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureUFUNCTION
Description
Linearly interpolates between A and B by Alpha, returning A at Alpha=0 and B at Alpha=1. The most commonly used scalar interpolation function.
Caveats & Gotchas
- • Alpha is not clamped — values outside [0,1] extrapolate beyond A or B. Clamp Alpha with FClamp first if overshoot is undesirable.
- • For smooth eased transitions use the Ease function instead; Lerp produces a constant-velocity blend which can feel mechanical for UI animations or camera moves.
Signature
static UE_INL_API double Lerp(double A, double B, double Alpha); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | double | Start value (returned when Alpha=0). | — |
| B | double | End value (returned when Alpha=1). | — |
| Alpha | double | Interpolation factor in [0,1]. | — |
Return Type
double Example
Fade volume over time C++
float Alpha = FMath::Clamp(ElapsedTime / FadeDuration, 0.0f, 1.0f);
float Volume = UKismetMathLibrary::Lerp(StartVolume, TargetVolume, Alpha);
AudioComponent->SetVolumeMultiplier(Volume); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?