Skip to content

Instantly share code, notes, and snippets.

@enjalot
Created January 30, 2013 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enjalot/4669854 to your computer and use it in GitHub Desktop.
Save enjalot/4669854 to your computer and use it in GitHub Desktop.
simple globe canvas
{"description":"simple globe canvas","endpoint":"","display":"canvas","public":true,"require":[{"name":"topojson","url":"http://d3js.org/topojson.v0.min.js"},{"name":"d3.geo.projection","url":"http://d3js.org/d3.geo.projection.v0.min.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"world110.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"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,"fullscreen":false,"thumbnail":"http://i.imgur.com/YrHQvRs.png"}
//http://bl.ocks.org/4188334
var world = tributary.world110;
var globe = {type: "Sphere"};
var countries = topojson.object(world, world.objects.countries)
var projection = d3.geo.orthographic()
.scale(265)
.translate([299, 352])
.rotate([0,0,0])
.center([0,0])
.clipAngle(90);
var context = tributary.ctx;
var path = d3.geo.path()
.projection(projection)
.context(context);
var colorScale = d3.scale.ordinal()
.range([
"#389934",
])
context.fillStyle = "#188A18";
context.beginPath();
path(countries);
context.fill();
context.strokeStyle = "#0D3500";
context.beginPath(), path(globe), context.stroke();
Display the source blob
Display the rendered blob
Raw
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