xxxxxxxxxx
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<script>
// Feel free to change or delete any of the code you see in this editor!
var svg = d3.select("body").append("svg")
.attr("width", 960)
.attr("height", 500)
var g = svg.append("g");
g.append("text")
.text("Watch me!")
.attr("y", 100)
.attr("x", 290)
.style("font-size", 46)
.style("font-family", "monospace")
g.append("text")
.text("I'm a chameleon!")
.attr("y", 200)
.attr("x", 240)
.style("font-size", 36)
.style("font-family", "monospace")
var my_colors = ["blue", "green", "purple", "orange", "red", "black"]
d3.range(my_colors.length).map(function (d){
d3.select("g").transition()
.delay(1200*d)
.style("fill", my_colors[d])
});
</script>
</body>
https://d3js.org/d3.v4.min.js