An example of using transition.styleTween to avoid using the computed style value, and instead use the style value as-set.
-
-
Save zocoi/2088c19e9e48059e9a95 to your computer and use it in GitHub Desktop.
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"> | |
<body> | |
<div style="width: 100px; height: 100px; background:brown;"/> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script> | |
function styleTween() { | |
return d3.interpolateString("translate(0,0)", "translate(50px, 50px)"); | |
}; | |
d3.select("div") | |
.styleTween("transform", styleTween) | |
.style("-webkit-transform", "translate(50px, 50px)"); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment