Skip to content

Instantly share code, notes, and snippets.

Last active February 9, 2016 02:00
  • Star 1 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?
Non-Computed Style Tween
license: gpl-3.0

An example of using transition.styleTween to avoid using the computed style value, and instead use the style value as-set.

<!DOCTYPE html>
<meta charset="utf-8">
<body style="background:brown;">
<script src="//"></script>
.call(styleTween, "background", "steelblue")
.call(styleTween, "background", "black");
function styleTween(transition, name, value) {
transition.styleTween(name, function() {
return d3.interpolate([name], value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment