Skip to content

Instantly share code, notes, and snippets.

@hemulin
Created July 2, 2013 21:47
Show Gist options
  • Save hemulin/5913506 to your computer and use it in GitHub Desktop.
Save hemulin/5913506 to your computer and use it in GitHub Desktop.
Wedding invitation
{"description":"Wedding invitation","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"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 canvasWidth = 800, canvasHeight = 600;
var canvas = d3.select("svg").append("svg")
.attr("width", canvasWidth)
.attr("height", canvasHeight);
var seaArea = [
[0, 600],
[800, 600],
[800, 600],
[600, 450],
[300, 500],
[200, 450],
[0, 500]
];
var sandArea = [
[0, 300],
[800, 300],
[800, 600],
[600, 450],
[300, 500],
[200, 450],
[0, 500]
];
var sea = canvas.selectAll("path.area")
.data([seaArea]) // dimension of data should be 3D
.enter().append("path")
.style("fill", "#464EE6")
.attr("class", "sea") // not the cause of your problem
.attr("d", d3.svg.area());
var sand = canvas.selectAll("path.area")
.data([sandArea]) // dimension of data should be 3D
.enter().append("path")
.style("fill", "#E7BB0C")
.attr("class", "sand") // not the cause of your problem
.attr("d", d3.svg.area());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment