D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
vicapow
Full window
Github gist
laser!
<!DOCTYPE html> <html> <script src="https://d3js.org/d3.v3.js" charset="utf-8"></script> <body> <script> var w = 800, h = 800, n = 40 var svg = d3.select('body').append('svg') .attr({width: w, height: h}) var data = d3.range(n) .map(function(d) { return (d + 1) / n / 2 }) .sort(function(a, b){ return b - a }) var g = svg.selectAll('g').data(data) .enter().append('g') .attr('transform', function(d) { return 'translate(' + [ w / 2, h / 2 ] + ') rotate(' + d * 900 + ')' }) g.append('rect') .style('fill', 'none') .style('stroke', 1) .attr('x', function(d) { return - w * d * 0.5 }) .attr('y', function(d) { return -h * d * 0.5 }) .attr('width', function(d) { return w * d }) .attr('height', function(d) { return h * d }) </script> </body> </html>
Modified
http://d3js.org/d3.v3.js
to a secure url
https://d3js.org/d3.v3.js