Animating customized opening icon

I am trying customizing the icons for my opening sensors for doors and windows, however, I loose the animation when the icons change. Anyone have an example of opened/closed window icon changes for binary sensors?

You can use group icon customization and visibility to control how binary sensors are displayed. I use animated icons for open / on states of my sensor / switches and invisible group when state is off / closed.

Do you have to create two groups for each sensor and two automation (one for open, one for close)? That would be a lot of groups/automation in my case.

Yes, I am afraid so. I had 36 sensors. I used microsoft word and excel to help format all the sensors into two automations and into a group. Its was a lot of find and replace but I only did it once and it formatted all the sensors.