d3/examples/hello-world/hello-transition-undefined....

39 строки
668 B
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<title>Hello, transition undefined!</title>
<style>
body {
font: 14px Helvetica Neue;
text-rendering: optimizeLegibility;
margin: 1em;
}
div {
font-size: 42px;
margin-top: .5em;
text-align: right;
}
</style>
Press any key:<br>
<div>hello</div>
<script src="../../d3.js"></script>
<script>
transform();
function transform() {
d3.select("div")
.style("width", "0%")
.transition()
.ease("bounce")
.duration(2000)
.style("width", "100%")
.style("background-color", function() { return d3.hsl(180, Math.random(), .5); });
}
d3.select(window).on("keypress", transform);
</script>