Using SVG to animate gradients

Gradients seem to be everywhere at the moment! Unfortunately, with CSS linear-gradient you are unable to transition from one CSS gradient to another smoothly, but there is another alternative.

Using SVG with a linearGradient, give you the opportunity to seamlessly animate the stop-color value with CSS to get that smooth transition.

The result reflects beautifully transitioned gradients, here though I’ve used a rainbow of colours to dramatise the effect.

See the Pen Background gradient animation with SVG by Tarah (@Tarah-S) on CodePen.