planetary.js/documentation/index.html
Brandon Tilley d37e31f23a Update site
2013-12-23 14:20:13 -08:00

132 lines
6.4 KiB
HTML

<!doctype html>
<html>
<head>
<title>Planetary.js: Awesome interactive globes for the web</title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Open+Sans:300italic,400,300,700' rel='stylesheet' type='text/css'>
<link type="text/css" rel="stylesheet" href="/semantic/css/semantic.min.css">
<link type="text/css" rel="stylesheet" href="/css/planetaryjs.css">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<link href="/css/prism.css" rel="stylesheet">
</head>
<body>
<div class='ui fixed inverted large menu main-menu'>
<div class='items'>
<a class='item title' href='/'>
<i class='globe icon'></i>Planetary.js
</a>
<span class='spacer hide-on-mobile'></span>
<a class='item minor' href='https://github.com/BinaryMuse/planetary.js/releases'>
<i class='download icon'></i><span class='hide-on-mobile'>Download</span>
</a>
<a class='item minor ' href='/examples/'>
<i class='laptop icon'></i><span class='hide-on-mobile'>Examples</span>
</a>
<a class='item minor active' href='/documentation/'>
<i class='book icon'></i><span class='hide-on-mobile'>Documentation</span>
</a>
<a class='item minor' href='https://github.com/BinaryMuse/planetary.js'>
<i class='github alternate icon'></i><span class='hide-on-mobile'>Fork on GitHub</span>
</a>
</div>
</div>
<div class='content container'>
<div class='page ui slim stackable grid'>
<div class='four wide column'>
<div class='ui fluid vertical menu'>
<a class='red item active' href='/documentation/index.html'>
Introduction
<i class='icon home'></i>
</a>
<a class='blue item ' href='/documentation/core.html'>
Core API
<i class='icon setting'></i>
</a>
<a class='orange item ' href='/documentation/planet.html'>
Planet API
<i class='icon globe'></i>
</a>
<a class='teal item ' href='/documentation/plugins.html'>
Plugins
<i class='icon edit'></i>
</a>
<a class='purple item with-subitems ' href='/documentation/builtin.html'>
Built-In Plugins
<i class='icon bolt'></i>
</a>
<div class='item contains-subitems'>
<div class='menu'>
<a class='item ' href='/documentation/builtin_earth.html'>Earth</a>
<a class='item ' href='/documentation/builtin_topojson.html'>TopoJSON</a>
<a class='item ' href='/documentation/builtin_oceans.html'>Oceans</a>
<a class='item ' href='/documentation/builtin_land.html'>Land</a>
<a class='item ' href='/documentation/builtin_borders.html'>Borders</a>
<a class='item ' href='/documentation/builtin_pings.html'>Pings</a>
<a class='item ' href='/documentation/builtin_zoom.html'>Zoom</a>
<a class='item ' href='/documentation/builtin_drag.html'>Drag</a>
</div>
</div>
<a class='red item ' href='/documentation/faq.html'>
FAQ
<i class='icon help'></i>
</a>
<a class='green item ' href='/documentation/help.html'>
Getting Help
<i class='icon phone'></i>
</a>
</div>
</div>
<div class='twelve wide column'>
<h1>Introduction</h1>
<p>Planetary.js is a JavaScript library for building awesome interactive globes. It uses <a href="http://d3js.org/">D3</a> and <a href="https://github.com/mbostock/topojson">TopoJSON</a> to parse and render geographic data. Planetary.js is a plugin-based system; even the default functionality is implemented as plugins! This makes Planetary.js extremely flexible.</p>
<p>The documentation is split up into several sections:</p>
<ul>
<li><a href="/documentation/core.html">Core API</a> describes the top-level Planetary.js API, including installing and configuring the library and creating new instances of planets.</li>
<li><a href="/documentation/planet.html">Planet API</a> describes the API associated with a planet instance, including modifying its properties and accessing a special canvas context that allows you to draw on the globe.</li>
<li><a href="/documentation/plugins.html">Plugins</a> describes the plugin architecture of Planetary.js and shows how you can easily build your own plugins to modify the behavior of Planetary.js</li>
<li><a href="/documentation/builtin.html">Built-In Plugins</a> describes each of the built-in plugins in turn, including their public API and how to use them in a project.</li>
</ul>
<h2>Quick Start</h2>
<p>If you want to get up-and-running quickly, or like to experiment and figure things out, you can use this HTML and JavaScript to get a quick, simple globe working quickly.</p>
<p>Note that you&#39;ll need to run this page from a web server of some kind so that Planetary.js can load the TopoJSON data via Ajax (Ajax requests don&#39;t work when viewing a page directly from the filesystem).</p>
<div class='ui raise segment'>
<div class='ui blue ribbon label'>HTML</div>
<pre><code class="language-html">&lt;html&gt;
&lt;head&gt;
&lt;script type=&#39;text/javascript&#39; src=&#39;http://d3js.org/d3.v3.min.js&#39;&gt;&lt;/script&gt;
&lt;script type=&#39;text/javascript&#39; src=&#39;http://d3js.org/topojson.v1.min.js&#39;&gt;&lt;/script&gt;
&lt;script type=&#39;text/javascript&#39; src=&#39;planetaryjs.min.js&#39;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;canvas id=&#39;globe&#39; width=&#39;500&#39; height=&#39;500&#39;&gt;&lt;/canvas&gt;
&lt;script type=&#39;text/javascript&#39; src=&#39;yourApp.js&#39;&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<div class='ui red ribbon label'>JavaScript</div>
<pre><code class="language-javascript">var planet = planetaryjs.planet();
// You can remove this statement if `world-110m.json`
// is in the same path as the HTML page:
planet.loadPlugin(planetaryjs.plugins.earth({
topojson: { file: &#39;http/path/to/world-110m.json&#39; }
}));
// Make the planet fit well in its canvas
planet.projection.scale(250).translate([250, 250]);
var canvas = document.getElementById(&#39;globe&#39;);
planet.draw(canvas);</code></pre>
<p></div></p>
</div>
</div>
</div>
<script type='text/javascript' src='/js/prism.js'></script>
</body>
</html>