Changing animation frame with variable

I have been searching for a while now on how to change an animation according to a value and found nothing, consider the following example:

When i press left click i have a variable that starts increasing, this variable goes to 0 when i release LMB, I also have a bow that needs to be pulled back accordingly to this value that increases when i press LMB.

So how do i “tie” the animation to the value of the variable?