Start and end positions are both “0” on the Z axis. When the image starts to lerp toward position it jumps to 800 on the Z axis.
IEnumerator RemoveDetail()
{
F_active = F_start.position;
F_inactive = F_target.position;
Vector2 F_current = Flag.position;
float rate = 200f;
float startTime = Time.time;
float distance = Vector2.Distance(F_active, F_inactive);
while (F_current != F_inactive)
{
float movement = (Time.time - startTime) * rate;
float moved = (movement / distance);
Flag.position = Vector2.Lerp(F_active, F_inactive, moved);
yield return null;
}
}