in certain frameworks there is a “close page handeler”
this will trigger an animation and once the animation is done, the page will be removed from the dom.
Mendix does not do this, so it is possible to create an on enter animation with css.
but creating a onclose animation is a lot more difficult to pull off.
in reactnative there are certain animation widgets that can trigger an animation and once the animation is done, it can trigger a nano/micro flow such as close page.