Using transition.tween to transition a property.
Range Transition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment