{
var n = 4002;
var whiteblue = d3.interpolateRgb("#eee", "steelblue"),
blueorange = d3.interpolateRgb("steelblue", "orange"),
orangewhite = d3.interpolateRgb("orange", "#eee");
const target = htl.html`<div><style>
#target {
max-width: 960px;
min-height: 550px;
margin: 1px;
}
#target > div {
width: 10px;
height: 10px;
margin: 1px 0 0 1px;
float: left;
background: #eee;
display: inline-block;
}
</style>
<div id="target"></div>
</div>`;
const chart = d3
.select(target)
.select("#target")
.selectAll("div")
.data(d3.range(n))
.join("div")
.transition()
.delay(function (d, i) {
return i + (Math.random() * n) / 4;
})
.ease(d3.easeLinear)
.on("start", function repeat(d, i) {
d3.active(this)
.styleTween("background-color", function () {
return whiteblue;
})
.transition()
.delay(1000)
.styleTween("background-color", function () {
return blueorange;
})
.transition()
.delay(1000)
.styleTween("background-color", function () {
return orangewhite;
})
.transition()
.delay(n)
.on("start", repeat);
});
return target;
}