As far as i can see, every frame you set either one of this animations: run or idle
After that, you may change that animation to fall or jump, but as you change it every frame (because previously you set run or idle) animation is restarted everey frame when you jump or fall.
Try something like this instead (although you will probably need to think about if that implementation is right for your use case):
if is_on_floor():
if not jumping and not falling:
if Input.is_action_pressed("ui_up"):
velocity.y = JUMP
jumping = true
if jumping:
$AnimatedSprite.play("jump")
jumping = false
falling = true
if falling:
$AnimatedSprite.play("jump")
falling = false
elif Input.is_action_pressed("ui_right"):
velocity.x = SPEED
$AnimatedSprite.play("run")
$AnimatedSprite.flip_h = false
elif Input.is_action_pressed("ui_left"):
velocity.x = -SPEED
$AnimatedSprite.play("run")
$AnimatedSprite.flip_h = true
else:
velocity.x = 0
$AnimatedSprite.play("idle")
velocity.y += GRAVITY
velocity = moveandslide(velocity, FLOOR)