Skip to content

Instantly share code, notes, and snippets.

Forked from mbostock/.block
Last active February 9, 2016 01:13
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Input Value Interpolation
license: gpl-3.0

This example uses a custom tween that interpolates the value property.

<!DOCTYPE html>
<meta charset="utf-8">
body {
padding: 40px;
input {
width: 880px;
<input type="range" value="0" min="0" max="255" step="any">
<script src="//"></script>
.tween("value", valueTween(255));
function valueTween(value) {
return function() {
var i = d3.interpolateNumber(this.value, value);
return function(t) { this.value = i(t); };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment