xxxxxxxxxx
<script src="https://d3js.org/d3.v4.min.js"></script>
<body>
<div style="margin-top: 250px;">
<h1 class="copCounter">0</h1>
</div>
</body>
<script>
var count = 3252;
var numberFormat = d3.format(",d");
ready(count);
function ready(data) {
d3.selectAll(".copCounter")
.transition()
.duration(5000)
.on("start", function repeat(d) {
d3.active(this)
.tween("text", function() {
var that = d3.select(this),
i = d3.interpolateNumber(that.text().replace(/,/g, ""), data);
return function(t) { that.text(numberFormat(i(t))); };
})
.transition()
.delay(1500)
.on("start", repeat);
});
}
</script>
https://d3js.org/d3.v4.min.js