How to apply transition to an overlay?

I was looking for this too and it seems this is not supported in CSS:

I’ve posted a possible workaround in the thread linked above, maybe it works for you.