Lerp on method

i need to call a method that calculates a value and then lerp another value using the calculated value,the problem is that i only need it to calculate once and continue the lerp afterwards is there some way to do this using only one method?

here is the code:

void Update()
{
LerpFogDensity(20, 5, );
}
  public void LerpFogDensity(float Value, float ValueinSeconds)
    {
        var _temp = (Mathf.Abs(FogFloat - Value))/ ValueinSeconds;

         FogFloat = Mathf.MoveTowards(FogFloat, Value, _temp* Time.deltaTime);
      
    }

An Answer to this can be be using Coroutines…

public IEnumerator LerpFogDensity(float Value, float ValueinSeconds, bool first, float continue_temp)
     {
       float _temp = 0f;
       if(first)
       {
         _temp = (Mathf.Abs(FogFloat - Value))/ ValueinSeconds;
       }
       else
       {
          _temp = continue_temp;
       }

          FogFloat = Mathf.MoveTowards(FogFloat, Value, _temp* Time.deltaTime);
       
       if(!Mathf.Approximately(FogFloat, _temp))
       {
         yield return 0;
         LerpFogDensity(Value, ValueInSeconds, false, _temp);
       }
       else
       {
          FogFloat = _temp;
       }
     }

after this you can call it from anywhere once like this…(the fourth parameter can be any random value, since it’ll be calculated anyway)

StartCoroutine(LerpFogValue(20f, 5f, true, 0f));

Hope this helps!!