How to know the source and the destination of the current transition.

I want to make a function that returns true if an animation is currently playing or its playing a transition that have that animation as source or destination. For now, I using this code:

return _animator.IsInTransition(0) || animator.GetCurrentAnimatorStateInfo(0).IsName(anim_name);

The problem is that if the function is called asking for some animation, and the animator is currently playing a transition, it will return true.

So there’s the question: Is there some way to know if the transition that is currently playing is targeting the animation, or it’s the transition source? Or there’s some easier way to do it?

Thank you!!

animationPosition is 0 by default, meaning entire transition since it’s began. Change value to whatever considering 1 being the end of transition.
Kinda if(GetCurrentAnimatorStateInfo(0.7) && IsInTransition(0.3)).
Play with the values, not sure, but that’s something to look at