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

pov-3d

v0.0.7

Published

The Web 3D Viewer is a free, open-source web solution for visualizing and navigating 3D models in a browser. With this library, you can easily add 3D model viewer capabilities to your web application without complex setup.

Downloads

6

Readme

pov-3d

Introduction to the Pov-3d Viewer Library

The Web 3D Viewer is a free, open-source web solution for visualizing and navigating 3D models in a browser. With this library, you can easily add 3D model viewer capabilities to your web application without complex setup.

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • Installation

    npm install pov-3d 
    yarn add pov-3d
  • Example npm Package Usage

<head>
  <script src="node_modules/pov-3d/build/pov-3d.js"></script>
</head>
  • Using unpkg.com with <script> Tags
<head>
    <script src="https://unpkg.com/pov-3d/build/pov-3d.js"></script>
</head>

Usage

The Web 3D Viewer library is designed to be easy to use and integrate into your web application. You can add a 3D model viewer to your web page by including the pov-3d-viewer custom element and setting the desired attributes.

Basic Example

<pov-3d-viewer model="path/to/3d-model.glb"></pov-3d-viewer>

Attributes

The pov-3d-viewer custom element supports the following attributes:

  • model - The path to the 3D model file.
  • preset - The preset configuration to use.
    • Available presets: Initial(Default), Bright, Dark, Polyground.
  • baseColor - The base color of the 3D model.
    • Accepts hex color codes (e.g., #ff0000).
  • autoRotate - Whether to enable auto-rotation of the 3D model.
  • loadProgress - Whether to display a loading progress bar.

Example with Attributes

<pov-3d-viewer 
  model="path/to/3d-model.glb" 
  preset="default" 
  baseColor="#ff0000" 
  autoRotate="on"
  loadProgress="on"
></pov-3d-viewer>

Events

The pov-3d-viewer custom element emits the following events:

  • pov-setup - Emitted when the default environment setup is completed for the pov-3d-viewer.
  • pov-ready - Emitted when the 3D model is ready to be loaded.
  • pov-event - Emitted when a custom event is triggered.
    • load-progress - Emitted when the 3D model loading progress changes.
    this.dispatchEvent(
        new CustomEvent("pov-event", {
          detail: {
            type: "load-progress",
            loaded: progressEvent.loaded,
            total: progressEvent.total,
          },
        }),
      );
  • pov-model-load - Emitted when the 3D model is loaded.

When working with events

  • Always use the pov- prefix when using events.
  • Event sequence: pov-setup -> pov-ready -> pov-model-load

Example with Events

<pov-3d-viewer></pov-3d-viewer>
<script>
    const povViewer = document.querySelector('pov-3d-viewer');
    
    povViewer.addEventListener('pov-setup', () => {
      console.log('Default environment setup completed');
      povViewer.setAttribute("preset", "bright");
      povViewer.setAttribute("base_color", "#ff0000");
      povViewer.setAttribute("auto_rotate", "on");
      povViewer.setAttribute("load_progress", "on");
    });
    
    povViewer.addEventListener('pov-ready', () => {
        console.log('3D model is ready to be loaded');
      povViewer.setAttribute("model", "path/to/3d-model.glb");
    });
  
    povViewer.addEventListener('pov-model-load', () => {
        console.log('3D model is loaded');
    });
  
    povViewer.addEventListener('pov-event', (event) => {
        console.log('Custom event:', event.detail);
    });

</script>

Contributing

This project is open-source and welcomes contributions from the community. You can contribute in various ways, including adding new features, fixing bugs, and improving documentation.

License

This library is distributed under the MIT License.