Last active
December 12, 2015 08:28
-
-
Save shancarter/4743822 to your computer and use it in GitHub Desktop.
Wavy Map Outlines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment