How to use animate properties on variables used inside conditions?

In the component, I want to open and close a certain area in the menu on each click? When I create a condition for it, I can provide this operation, but how can I use the animate properties? Or is it a wrong method?