I don’t understand why gravity is only applied when jumping. Remove else and move this under the physics process.
Why are these in separate functions? You can move all those under the physics process.
From experience, it is better to change animations from somewhere they will be called just once after button press is detected, like in the input () function with Input.is_action_just_pressed. Most movement animations are actually just loops anyway, so you only need to call them once.
Calling animation change in the physics_process every time a condition is meant will cause you problems. For example, in your code, as long as the player is moving, animated_sprite_2d.animation = “run” will be called every frame. For a running animation, you may not notice is constantly restarting the animation, but for other animations like jump, you will definitely notice.