Just your BBC spinny globe, circa 1985. (TODO: add reversed antipodes as bg layer.)
-
-
Save blech/6025967 to your computer and use it in GitHub Desktop.
BBC One
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"> | |
<title>BBC One Globe. husk.org.</title> | |
<body> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://d3js.org/topojson.v1.min.js"></script> | |
<script> | |
var width = 960, | |
height = 500, | |
velocity = .01, | |
then = Date.now(); | |
var projection = d3.geo.orthographic() | |
.scale(250) | |
.translate([width / 2, height / 2]) | |
.clipAngle(90); | |
var canvas = d3.select("body").append("canvas") | |
.attr("width", width) | |
.attr("height", height); | |
var c = canvas.node().getContext('2d'); | |
var path = d3.geo.path() | |
.projection(projection) | |
.context(c); | |
d3.json("/d/5879060/world-110m.json", function(error, world) { | |
var land = topojson.feature(world, world.objects.land), | |
globe = {type: "Sphere"}; | |
d3.timer(function() { | |
var angle = velocity * (Date.now() - then); | |
var rotate = [0, 0, 0]; | |
rotate[0] = angle, projection.rotate(rotate); | |
c.clearRect(0, 0, width, height); | |
c.fillStyle = 'rgba(0,0,102,1)', | |
c.beginPath(), | |
path(globe), | |
c.fill(), | |
c.stroke(); | |
c.fillStyle = 'rgba(0,204,0,.75)', | |
c.beginPath(), | |
path(land), | |
c.fill(); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment