I'd like to add that after I used this code in mine, my character seemed to have a unintended delay/cooldown on his jump.
is_on_floor() wasn't being updated on time because the
while loop was slowing the code by waiting the condition to end.
And my character reached the ground before the loop was done.
Writing this on the next line after
yield() fixed it.
while lerp_amount < 1:
lerp_amount += delta
motion.y = lerp(-800, gravity, lerp_amount)