Hi Eric ,
For the first question you can set a variable in the compositionReady function which will act as a flag which will help to make sure that animation plays only once until reverse animation is played through click event . Please refer the attached file .
For the second question can you please elaborate your problem in detail ? Sorry for not understanding what you meant by "exapnd animation " and " collapse animation "
Thanks
Saurav