Skip to content

Instantly share code, notes, and snippets.

/_.md

Created November 18, 2012 04:33
Show Gist options
  • Save anonymous/4103562 to your computer and use it in GitHub Desktop.
Save anonymous/4103562 to your computer and use it in GitHub Desktop.
Another Inlet
{"description":"Another Inlet","endpoint":"","display":"svg","public":true,"require":[],"tab":"edit","display_percent":0.7,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01}
var svg = d3.select("svg");
var size = 29;
var x = size;
var y = size;
dataset = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]
var rects = svg.selectAll('rect').data(dataset).enter()
.append('rect')
var circles = svg.selectAll('circle').data(dataset).enter()
.append('circle')
rects
.attr('width', size)
.attr('height', size)
.attr('x', function(d) {
return d * x
})
.attr('y', function(d) {
return d * y
})
circles
.attr('r', function(d) {
if (d > 15)
return d * size / 30
else if(d > 7)
return d * size / 20
else
return d * size / 10
})
.attr('cx', function(d) {
return d * x + 200
})
.attr('cy', function(d) {
return d * y
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment