FMath::CInterpTo stops interpolating after one frame.

When I use Fmath::CInterpTo in the following manner, interpolation stops after a single first frame, and the color never gets close becoming to the target color. Is this expected behavior in the following case? Is there something I can do to make interpolation continue past the first frame?

In AMyHUD.cpp:

// After a three second delay, HUDTimer() calls FadeTransition().  
void AMyHUD::HUDTimer()
{
    GetWorldTimerManager().SetTimer(AMyHUD::TimerHandle1, this, &AMyHUD::FadeTransition, 3.0f, false);
}

//FadeTransition() is supposed to interpolate the color variable named CurrentTransitionColor from clear to black in 2 seconds.  However, the interpolation process prematurely stops after one frame.  
void AMyHUD::FadeTransition()
{
    CurrentTransitionColor = FMath::CInterpTo(FLinearColor(1.f, 1.f, 1.f, 0.f), FLinearColor(1.f, 1.f, 1.f, 1.f), 2.0f, 1.0f);
}

// DrawHUD() is continually drawing a rectangle over the screen that is the color of the CurrentTransitionColor variable.  The rectangle never becomes black like expected, because color interpolation stops early.  
void AMyHUD::DrawHUD()
{
    Super::DrawHUD()
    AMyHUD::DrawRect(CurrentTransitionColor, 0.f, 0.f, Canvas->ClipX, Canvas->ClipY);
}

Is the interpolation expected to stop after just one frame in this case? How could it be continued beyond the first frame? Thanks.

CInterpTo is stateless, it has no knowledge of previous frames, your code here:

CurrentTransitionColor = FMath::CInterpTo(FLinearColor(1.f, 1.f, 1.f, 0.f), FLinearColor(1.f, 1.f, 1.f, 1.f), 2.0f, 1.0f);

Will always result in the same value. What you instead want to do is call it each tick like so:

CurrentTransitionColor = FMath::CInterpTo(CurrentTransitionColor, TargetColor, 2.0f, 1.0f);

So each frame it always interpolates from the current color to the target color and updates the current color with the result.

In FadeTransition (and your constructor) you want to set the the current and target colors to whatever you wish to interpolate between.

I put the revised CInterpTo into AMyHUD::Tick, set the original and target colors in the AMyHUD constructor, and use FadeTransition to set a new target color. However, every time FadeTransition sets a new target color, the current color turns into the target color after a single frame. Am I misinterpreting the suggested solution?

I also tried putting CInterpTo into AMyHUD::DrawHUD, but that did not help either…