CSS transition. Change background color.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
#box1{
background: #9DCEFF;
width: 400px;
height: 200px;
}
</style>
</head>
<body>
<h1>CSS transitions</h1>
<div id="box1">Content in box 1</div>
<button onclick="changeBG('box1','#F0F');">Magenta</button>
<script>
function changeBG(el, clr){
var elem = document.getElementById(el);
elem.style.transition = "background 1.0s linear 0s";
elem.style.background = clr;
}
</script>
</body>
</html>