npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

globe.js

v2.0.0

Published

WebGL based globe for visualisation

Downloads

15

Readme

globe.js

Simple way to visualise things on a 3D globe

See a live demo here.

Usage

Get it from NPM

npm install globejs

Using with Browserify or without it

This package can be used with browserify like this:

var Globe = require('globejs');

Globe.init("world.jpg", 0.005);

or in vanilla Javascript like this:

<script src="globe.js" data-compat="true"></script>
<script>
  window.Globe.init("world.jpg", 0.005);
</script>

Simple example

In the simplest case, you can get things on the globe like this:

<!doctype html>
<html>
<body>
  <script src="globe.js" data-compat="true"></script>
  <script>
    var latitude = 47.367347, longitude = 8.550002, color = 0x0000ff;
    window.Globe.init("world.jpg", 0.005);
    window.Globe.add(latitude, longitude, 0, color); // blue marker on Zurich
  </script>
</body>
</html>

Using more advanced options

In this case, we will add it into a container, have it transparent and with a red background colour. We will also specify a callback that is called when a frame is rendered, that just logs to console.

<!doctype html>
<html>
<body>
  <div id="worldcontainer" style="width:500px; height:500px"></div>

  <script src="globe.js" data-compat="true"></script>
  <script>
    var latitude = 47.367347, longitude = 8.550002, height = 200, color = 0x0000ff;

    window.Globe.init("world.png", 0.005, {
      bg: 0xff0000,
      animation: true,
      transparent: true,
      onRender: function() { console.log("Rendered."); },
      container: document.getElementById("worldcontainer")
    });

    window.Globe.add(latitude, longitude, height, color); // blue marker on Zurich
  </script>
</body>
</html>

Adding markers

Markers can be added like this:

var marker = window.Globe.add(latitude, longitude, height, color);

Where:

  • latitude and longitude are decimal degrees between -90/+90 (latitude) and -180/+180 (longitude), e.g. 47.367347 and 8.550002 for Zurich.
  • height is the height of the marker sticking out of the globe. For comparison: The globe has a radius of 600 canvas pixels...
  • color is a hex number representing the RGB color, e.g. 0xff0000 for red, 0x00ff00 for green, etc.

"Fly in" animation for markers

Using the animation option, you can let the new markers "fly in". Check out the live demo here.

Hack it / Contribute

Hacking

  1. Clone this repository
  2. Install all the dependencies
  3. Run the dev task to watch and auto-rewrite the browserify bundle while hacking

Like this:

git clone https://github.com/avgp/globe.js.git
cd globe
npm install
npm run dev

Then run the static file server of your choice, e.g. python -m SimpleHTTPServer and tweak it to your needs.

Contributing

All contributions welcome - if you're not sure about something, please don't hesitate to open an issue or pull request!

To get started for contributing, do:

  1. Fork the repo on github
  2. Clone your fork
  3. Create a new branch for the thing you'll be working on
  4. Code code code
  5. Push to your fork
  6. Make a pull request against the gh-pages branch of this repository.

Thank you very much!