1 3D animation transition not blending

Godot Version

4.2.2.stable

Question

I have an couple animations in use for idling (not moving), walking, and running. I have got all of the transitions from one animation to another to work, except for one: running then letting go of the shift key to start walking while continuing to hold down a movement key (wasd)

here is my code for setting the blend times:

animation_player.set_blend_time(“idle”, “walk”, 0.2)
animation_player.set_blend_time(“walk”, “idle”, 0.2)
animation_player.set_blend_time(“run”, “walk”, 0.2)
animation_player.set_blend_time(“walk”, “run”, 0.2)
animation_player.set_blend_time(“run”, “idle”, 0.2)
animation_player.set_blend_time(“idle”, “run”, 0.2)

here is my code to change animations based on action pressed:

var input_dir = Input.get_vector(“left”, “right”, “forward”, “backward”)
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED

	visuals.look_at(direction + position)
	
	if Input.is_action_pressed("sprint"):
		velocity.x *= SPRINT_VELOCITY
		velocity.z *= SPRINT_VELOCITY

		if !sprinting and Input.is_action_pressed("sprint"):
			sprinting = true
			animation_player.play("run")
	
	#and !(Input.is_action_pressed("sprint"))
	elif walking:
		animation_player.play("walk")
		sprinting = false
		
	elif !walking and !(Input.is_action_pressed("sprint")):
		walking = true
		sprinting = false
		animation_player.play("walk")
		
else:
	velocity.x = move_toward(velocity.x, 0, SPEED)
	velocity.z = move_toward(velocity.z, 0, SPEED)
	
	if walking:
		walking = false
		animation_player.play("idle")
	elif sprinting:
		sprinting = false
		animation_player.play("idle")
		velocity.x = direction.x * SPEED
		velocity.z = direction.z * SPEED

the ‘walking’ and ‘sprinting’ variables are used to determine if I am in a walking state or a sprinting state. these are false by default.

to clarify, the animation blends work in any other form (idling to walking, walking to sprinting, idling to sprinting, sprinting to idling, etc), but the only one that isnt blending is sprinting to walking.

i am happy to provide more info if needed.