block by vicapow 9338346

9338346

Full Screen

index.html

<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="../../d3.js"></script>
<script src="../../topojson.js"></script>
<style>
  body{
    margin: 0;
  }
</style>
<script>

// originally from: //bl.ocks.org/mbostock/3734273

// width = window.innerWidth, height = window.innerHeight
var width = 1050, height = 1500

var velocity = .01,
    t0 = Date.now();

var projection = d3.geo.equirectangular()
  .translate([width/2, height/2])
  .scale(500)

var canvas = d3.select("body").append("canvas")
    .attr("width", width)
    .attr("height", height);

var context = canvas.node().getContext("2d");

var path = d3.geo.path()
    .projection(projection)
    .context(context);

d3.json("/d/4090846/world-110m.json", function(error, world) {
  var land = topojson.feature(world, world.objects.land);

  window.step = function() {
    var t = Date.now() - t0;
    projection.rotate([0, velocity * t]);
    context.clearRect(0, 0, width, height);
    context.beginPath();
    path(land);
    context.fill();
  }
  window.is_ready = true
});

</script>