Make an Animation Move Back a Few Frames

hello, I’m creating a game and I’ve reached a part where I need to create an animation that the player can go back or forward a few frames, I wanted to know if there’s a way to do this by code.

And like a camera system that some games have, which allows the player to “move” the recording to see what was happening before, like isos.

Can someone help me? I’m In Unity 2D

Hello, I created a script that for me to solve

    public Animator Animator;

    void Start()
    {
        Animator.StartPlayback();
    }

    void Update()
    {
        if (Input.GetKey(KeyCode.Space)) { Animator.speed = 0f; }
        if (Input.GetKeyDown(KeyCode.D)) { Animator.speed = 1f; }
        if (Input.GetKeyDown(KeyCode.A)) { Animator.speed = -1f; }

    }

I hope that helps