block by mbostock 7367177

Range Transition

Full Screen

Using transition.tween to transition a property.

index.html

<!DOCTYPE html>
<meta charset="utf-8">
<style>

body {
  max-width: 640px;
  margin: 40px auto;
}

input {
  width: 100%;
}

</style>
<input type="range" min="0" max="1000" step="1" value="0">
<script src="//d3js.org/d3.v3.min.js"></script>
<script>

d3.select("input").transition()
    .duration(7500)
    .tween("value", function() {
      var i = d3.interpolate(this.value, this.max);
      return function(t) { this.value = i(t); };
    });

</script>