How to detect if an object in moving in a certain direction

Hi, I realise this is probably a really dumb question, but I cant figure out how to detect if an object is moving in a certain direction.

Basically, I control the character with the following script example:

            if (Input.GetKey(playerControls.playerOneControlLeft))
            {
                transform.position -= new Vector3(0.035f * playerAttributes.playerOneBaseMoveSpeed, 0, 0) * Time.deltaTime;

            }

So if I wanted my animation script to detect which direction the player is moving in and adjust the sprite sheet accordingly, how would be best to do this?

I assumed it would be along the lines of “if Vector3.left > 0” or something like that, but I cannot quite get it to work.

Please can someone help me? (in C# please)

I think this might work:

public class Something : MonoBehaviour
{
   private Vector3 prevPos;

   void Start()
   {
      prevPos = transform.position;
   }

   void Update()
   {
      if (Input.GetKey(playerControls.playerOneControlLeft))
            {
                transform.position -= new Vector3(0.035f * playerAttributes.playerOneBaseMoveSpeed, 0, 0) * Time.deltaTime;
                
                Vector3 direction = transform.position - prevPos; //heres your direction in this frame


                prevPos = transform.position;
 
            }
   }
}