How a CSS animation works