borrowed: Pure CSS3 Gradient Background Animation, How to do fade-in and fade-out with JavaScript and CSS - Stack Overflow