Skip to content

Instantly share code, notes, and snippets.

@seliopou
Created February 18, 2013 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seliopou/4981624 to your computer and use it in GitHub Desktop.
Save seliopou/4981624 to your computer and use it in GitHub Desktop.
orbitals
{"description":"orbitals","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"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 dim = 500,
dimh = dim / 2,
num = 13;
var x = d3.scale.linear().domain([0, num + 1]).range([dimh, dimh * 3]);
var svg = d3.select('svg')
.attr('width', dim)
.attr('height', dim);
var defs = svg.append('defs');
defs.append('clipPath')
.attr('id', 'circle-clip')
.append('circle')
.attr('cx', x(0))
.attr('cy', dimh)
.attr('r', dimh);
defs.append('clipPath')
.attr('id', 'rect-clip')
.append('rect')
.attr('x', 0)
.attr('width', dimh + 10)
.attr('height', dim)
svg.append('g')
.attr('clip-path', 'url(#circle-clip)')
.selectAll('circle')
.data(d3.range(1, num + 1))
.enter().append('circle')
.attr('class', 'orbital')
.attr('cx', x)
.attr('cy', dimh)
.attr('r', dimh);
svg.append('g')
.attr('clip-path', 'url(#rect-clip)')
.datum(0)
.append('circle')
.attr('class', 'orbital')
.attr('cx', x)
.attr('cy', dimh)
.attr('r', dimh);
.orbital {
fill: none;
stroke: rgb(2, 47, 98);
stroke-width: 2px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment