Create a gist now

Instantly share code, notes, and snippets.

@jonsadka /.block
Last active Sep 18, 2016

Embed
Playing with d3.timer()
license: mit

Playing with d3.timer().

<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script>
var width = window.innerWidth || 960,
height = window.innerHeight || 500;
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.timer(function() {
for (var i = 0; i < 2; i++) {
svg.append("circle")
.attr("cx", function(){
return Math.random()*width;
})
.attr("cy", function(){
return Math.random()*height;
})
.attr("r", 0)
.transition()
.attr("r", 3);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment