More generalized transition class, so it can be used for popups

I wanted to have transitions for showing and removing popups. These seemed the natural way to do it.