As if these problems have a huge set of ready-made solutions, for example in vanilla JS without JQ:
Well, if you use JQuery, then probably easier then to use FancyBox 3
Hmm... but seriously everything is pretty easy to implement and no extra dependencies. In this example
almost certainly has the standard functionality, but code quality is not too good, and work for one picture. And if 200 for example? It will help the cycle. When the window is opened of course is the animation, but when closing, it is not. Can be solved with additional classes + setTimeOut. Flipping directly in the active mode can be done, but this will be a bit more difficult.
If I find time, I'll draft up a version without dependencies and if possible, will update the answer.