I’m a bit unclear how a property like visibility can be animated, given that it is binary in nature. I did attempt to experiment with it in codepen but haven’t achieved much success. visibility is listed as an animatable property so perhaps it comes down to me using firefox.
For your code the error is in #rect, animation-duration accepts time in units of “s” or “ms” (e.g. animation-duration:3s;)
The infinite value should pair with animation-iteration-count property instead.
Sidenote, you can achieve a sort of “blinking” effect with opacity. example: