Tweaked to be a throbber for showing current location on a map.
Forked from: Styled after Series of Concentric Circles Emanating from Glowing Red Dot in The Onion.
Tweaked to be a throbber for showing current location on a map.
Forked from: Styled after Series of Concentric Circles Emanating from Glowing Red Dot in The Onion.
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.ring { | |
fill: none; | |
stroke: #BE2525; | |
stroke-width: 8; | |
} | |
</style> | |
<body> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script> | |
var svg = d3.select("body").append("svg") | |
.attr("width", 960) | |
.attr("height", 500); | |
function addThrobber(x, y) { | |
var translate = "translate(" + x + ", " + y + ")"; | |
return setInterval(function() { | |
svg.append("circle") | |
.attr("class", "ring") | |
.attr("transform", translate) | |
.attr("r", 6) | |
.transition() | |
.ease("linear") | |
.duration(3000) | |
.style("stroke-opacity", 1e-6) | |
.style("stroke-width", 1) | |
.style("stroke", "brown") | |
.attr("r", 50) | |
.remove(); | |
}, 850); | |
} | |
addThrobber(100, 100); | |
addThrobber(200, 100); | |
addThrobber(150, 150); | |
addThrobber(100, 200); | |
addThrobber(200, 200); | |
</script> |