Skip to content

Instantly share code, notes, and snippets.

@trinary
Created June 25, 2013 21:34
Show Gist options
  • Save trinary/5862649 to your computer and use it in GitHub Desktop.
Save trinary/5862649 to your computer and use it in GitHub Desktop.
Tributary inlet
{"description":"Tributary inlet","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}},"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 rhombus = "M-30,0 L0,-48 L30,0 L0,48 Z";
var svg = d3.select("svg");
var c= svg.append("g").classed("c",true).attr("transform","translate(76,43)");
var data = d3.range(50);
c.selectAll(".rhomb").data(data).enter()
.append("path")
.classed("rhomb", true)
.attr("d",rhombus)
.attr("transform",function(d,i) {
return "translate(" + [0,i * 5] + ") rotate("+ (i % 5) * 30+") scale(" + [(50-d) / 50,(50-d)/50] + ")";
});
.rhomb {
stroke: teal;
stroke-width: 1.5px;
fill:white;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment