Animation and c++

Hi guys, i’m learning to use the UE4 from more or less one month and i’m making a code based code project. I’m trying to make animations in AnimBlueprint but the variable that have to control the transition between the animations are controlled by key binding in the code. When i press “R” key i call a function that put a variable from false to true and i want this variable to control the transition between two animations. How can i do?
Thanks in advance for answering