Trying to make an animation delay between each loop

Hello! So I have been trying to make an animation play, stop for a bit, then resume playing, and do that forever.

I have tried using plain code ( which requires animations to be in legacy and don’t work in the animator), animation events (by making it call a function after every loop that resets a parameter to not allow a blank state to transition to the actual animation state and back but that doesn’t work), animator parameters, animator transition conditions, animation events, and no success.

This sounds so simple and yet is so hard to find an answer to. Suggestions on how to do this sort of thing would be appreciated. Thanks in advance!

Animator anim;

    void Start()
    {
        StartCoroutine(PlayAnimation());
    }
    IEnumerator PlayAnimation()
    {
        while (true)
        {
            anim.SetBool("play", true);
            yield return new WaitForSeconds(1);
            anim.SetBool("play", false);
        }
    }

Assuming you have animator set properly.

If anyone else comes across this I needed to do the same thing but instead just added a blank image on the timeline at the end and another about 10 frames over, creating a gap in time depending on how long you want it to pause.