Built with blockbuilder.org
forked from ocarneiro's block: simple circle
xxxxxxxxxx
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://d3js.org/d3-selection-multi.v1.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<script>
var svg = d3.select("body").append("svg")
.attrs({"width": 960,
"height": 500,
"bgcolor": "black"})
var ball = svg.append("circle")
.attrs({ // provided by selection-multi module
"r": 73,
"cx": 480,
"cy": 250
})
.style("fill", "#ffe41e");
var changeColor = function() {
if (ball.green) {
ball.style("fill", "#ffe41e");
ball.green = false;
} else {
ball.green = true;
ball.style("fill", "green");
}
}
ball.on("click", changeColor);
</script>
</body>
https://d3js.org/d3.v4.min.js
https://d3js.org/d3-selection-multi.v1.min.js