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

@omnedia/ngx-three-globe

v1.0.2

Published

A simple component library to create a container with an animated and interactive globe.

Downloads

88

Readme

ngx-three-globe

@omnedia/ngx-three-globe is an Angular library that provides an interactive, 3D globe visualization built using three-globe and three.js. This component offers customizable globe settings, light sources, and animated arcs and rings, making it perfect for data visualization or adding dynamic elements to your Angular applications.

Features

  • Fully interactive 3D globe visualization with customizable settings.
  • Animated arcs and rings for displaying data between different locations on the globe.
  • Customizable globe appearance, including atmosphere, lighting, and rotation.
  • Built using three-globe and three.js for smooth rendering and interaction.

Installation

Install the library and the required peer dependencies using npm:

npm install @omnedia/ngx-three-globe
npm install three three-globe --save

Both three-globe and three are required as peer dependencies for this library to function correctly.

Usage

Import the NgxThreeGlobeComponent in your Angular module or component:

import { NgxThreeGlobeComponent } from '@omnedia/ngx-three-globe';

@Component({
  ...
  imports: [
    ...
    NgxThreeGlobeComponent,
  ],
  ...
})

Use the component in your template:

<om-three-globe
  [globeSize]="'800px'"
  [globeConfig]="{
    globeColor: '#062056',
    atmosphereColor: '#ffffff',
    autoRotate: true,
    autoRotateSpeed: 1
  }"
  [arcAndRingColors]="['#06b6d4', '#3b82f6', '#6366f1']"
  styleClass="custom-globe-class"
></om-three-globe>

API

<om-three-globe
  [globeSize]="globeSize"
  [globeConfig]="globeConfig"
  [arcAndRingColors]="arcAndRingColors"
  [arcs]="ThreeGlobePosition[]"
  styleClass="your-custom-class"
>
</om-three-globe>
  • globeSize (optional): The size of the globe in pixels. Accepts a string value such as '600px' or '100%'. Defaults to '600px'.
  • globeConfig (optional): A configuration object that defines the appearance and behavior of the globe, including lighting, atmosphere, rotation, and more. See the configuration options below.
  • arcAndRingColors (optional): An array of color strings used to customize the arcs and rings displayed on the globe. They will get random colors from this array.
  • arcs (optional): An array of ThreeGlobePosition objects used to add customized arcs if the default ones arent whats needed.
  • styleClass (optional): A custom CSS class to apply to the globe's wrapper element for additional styling.

Example

<om-three-globe
  [globeSize]="'500px'"
  [globeConfig]="{
    globeColor: '#0a2f5b',
    showAtmosphere: true,
    atmosphereColor: '#f5f5f5',
    autoRotate: true,
    autoRotateSpeed: 0.8,
    pointLight: '#ffffff'
  }"
  [arcAndRingColors]="['#ff6b6b', '#f06595', '#faa2c1']"
  styleClass="globe-custom-style"
></om-three-globe>

This example creates a globe with custom colors, atmosphere, and rotation speed, along with animated arcs connecting various points.

Globe Configuration Options

The globeConfig input allows you to configure various aspects of the globe's appearance and behavior:

  • pointSize: The size of points on the globe.
  • globeColor: The main color of the globe.
  • showAtmosphere: A boolean to toggle the atmosphere effect around the globe.
  • atmosphereColor: The color of the atmosphere surrounding the globe.
  • atmosphereAltitude: The altitude of the atmosphere.
  • emissive: The emissive color of the globe's material.
  • emissiveIntensity: The intensity of the globe's emissive color.
  • shininess: The shininess of the globe's surface.
  • polygonColor: The color of polygons on the globe (e.g., country borders).
  • ambientLight: The color of the ambient light.
  • directionalLeftLight: The color of the left directional light.
  • directionalTopLight: The color of the top directional light.
  • pointLight: The color of the point light.
  • arcTime: The duration of the arc animation.
  • arcLength: The length of the animated arcs.
  • rings: The number of rings around the globe.
  • maxRings: The maximum number of rings allowed.
  • manualRotate: A boolean to enable or disable manual rotation of the globe.
  • autoRotate: A boolean to enable or disable automatic rotation of the globe.
  • autoRotateSpeed: The speed at which the globe rotates automatically.

Dependencies

This library relies on the following peer dependencies for rendering and interactivity:

  • three - The 3D rendering library used to create and manage 3D scenes.
  • three-globe - A library built on three.js for creating and animating globes with custom data visualizations.

Ensure that both of these dependencies are installed alongside the library.

npm install three three-globe --save

Styling

To customize the appearance of the globe or container, use the styleClass input to apply your own CSS classes.

.globe-custom-style {
  background-color: #000;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

Contributing

Contributions are welcome. Please submit a pull request or open an issue to discuss your ideas.

License

This project is licensed under the MIT License.