Skip to content

Instantly share code, notes, and snippets.

@shancarter
Last active December 12, 2015 08:28
Show Gist options
  • Save shancarter/4743822 to your computer and use it in GitHub Desktop.
Save shancarter/4743822 to your computer and use it in GitHub Desktop.
Wavy Map Outlines
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
background: white;
}
.land {
fill: #00ff00;
stroke: white;
stroke-width: 1px;
stroke-linejoin: round;
}
.boundary {
fill: none;
stroke: #fff;
stroke-width: .5px;
}
.wave {
stroke: #ff00ff;
stroke-linejoin: round;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/d3.geo.projection.v0.min.js"></script>
<script src="http://d3js.org/topojson.v0.min.js"></script>
<script>
var width = 960,
height = 400;
var projection = d3.geo.miller()
.scale(80)
.translate([width / 2, height / 2]);
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("world-countries-400px.json", function(error, world) {
svg.selectAll(".wave")
.data([0, 1, 2, 3, 4])
.enter().append("path")
.datum(topojson.object(world, world.objects.land))
.attr("class", "wave")
.attr("d", path)
.attr("stroke-width", function(d, i) { return i * 10; })
.attr("stroke-opacity", function(d, i) { return 0.15; });
svg.append("path")
.datum(topojson.object(world, world.objects.land))
.attr("class", "land")
.attr("d", path)
});
</script>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment