Godot Version
4.3
Question
how do i make it immediately switch, cancelling out the jump animation?
you need a condition on the transitions to prevent an infinite loop.
using a “at ends” transition works because godot knows to switch the state when the animation reaches its end. but with looped animations or for an instant switch you need some condition to start a transition.
I recommend that you scrap that code and instead use expressions on the transitions.
here is my tutorial on animation tree expressions:
https://godotforums.org/d/39521-this-is-how-to-use-animationtree-state-machine-transitions-with-expressions
so you would have a jump variable that is changed when the button is pressed, and then each transition will have its own code that evaluates the variables.
this will give you more control and also make the code cleaner.
Change the Mode to Enabled and it will switch when you change it in code. @jesusemora gives good advice, so I recommend taking a look at that tutorial. You also would probably benefit from watching a few tutorials on AnimationTree, as those things are generally covered.