Update rotating example

This commit is contained in:
Brandon Tilley 2013-12-23 15:02:27 -08:00
parent bae0d216e6
commit 72cbd4990d
2 changed files with 10 additions and 8 deletions

View File

@ -19,10 +19,11 @@
planet.loadPlugin(planetaryjs.plugins.earth({ planet.loadPlugin(planetaryjs.plugins.earth({
topojson: { file: '/world-110m.json' } topojson: { file: '/world-110m.json' }
})); }));
// Scale the planet's radius to half the canvas' size... // Scale the planet's radius to half the canvas' size
planet.projection.scale(canvas.width / 2); // and move it to the center of the canvas.
// ...and move the planet to the center of the canvas. planet.projection
planet.projection.translate([canvas.width / 2, canvas.height / 2]); .scale(canvas.width / 2)
.translate([canvas.width / 2, canvas.height / 2]);
planet.draw(canvas); planet.draw(canvas);
})();</code></pre> })();</code></pre>
</div> </div>

View File

@ -6,9 +6,10 @@
planet.loadPlugin(planetaryjs.plugins.earth({ planet.loadPlugin(planetaryjs.plugins.earth({
topojson: { file: '/world-110m.json' } topojson: { file: '/world-110m.json' }
})); }));
// Scale the planet's radius to half the canvas' size... // Scale the planet's radius to half the canvas' size
planet.projection.scale(canvas.width / 2); // and move it to the center of the canvas.
// ...and move the planet to the center of the canvas. planet.projection
planet.projection.translate([canvas.width / 2, canvas.height / 2]); .scale(canvas.width / 2)
.translate([canvas.width / 2, canvas.height / 2]);
planet.draw(canvas); planet.draw(canvas);
})(); })();