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

@lumiscaphe/react-viewer

v2.0.1

Published

Official React component for Lumiscaphe 3D Viewer

Downloads

1,972

Readme

react-viewer

Lumiscaphe 3D Viewer React Component

Installation

$ npm i @lumiscaphe/react-viewer

or

$ yarn add @lumiscaphe/react-viewer

The basics

Initialize Lumiscaphe Viewer as simply as this:

const server = 'https://wr.lumiscaphe.com';

const scene = [{
  database: 'ee294840-5689-49b0-9edb-527598602df0',
  configuration: 'Bin.Blue/Cabin.Yellow/Style.Design1/Wheels.Red',
  animations: ['LeftDoor'],
}];

const view = {
  mode: 'image',
  camera: 'EXTER/1',
  background: 'product',
};

// Optional
const transition = {
  fromPosition: 0,
  toPosition: 2,
  animation: {
    name: 'Porte Gauche',
    camera: '/Camera_Ext',
    duration: 1,
    reverse: false,
  },
};

// Optional - default values
const encoder = {
  format: 'jpeg',
  quality: 80,
};

// Optional - default values
const parameters = {
  antialiasing: false,
  superSampling: 2,
};

// Optional - default values
const onLoadStart = () => {};
const onLoadProgress = () => {};
const onLoadEnd = () => {};
const onLoadError = () => {};
const onVrcubeInteraction = () => {};
const onVrobjectInteraction = () => {};
};

const element = (
  <LumiscapheViewer
    server={server}
    api='v1'
    fit='cover'
    scene={scene}
    view={view}
    transition={transition}
    encoder={encoder}
    parameters={parameters}
    onLoadStart={onLoadStart}
    onLoadProgress={onLoadProgress}
    onLoadEnd={onLoadEnd}
    onLoadError={onLoadError}
    onVrcubeInteraction={onVrcubeInteraction}
    onVrobjectInteraction={onVrobjectInteraction}
  />
);

ReactDOM.render(element, document.body)

Server

WebRender url for v1 and v2 api

Api

API to use:

  • v1: uses WebRender v1 API to generate images
  • v2: uses WebRender v2 API to generate images
  • static: uses image array scene as images sources

Fit

Image fit mode to use:

  • contain: image is scaled to maintain its aspect ratio while fitting within the element's content box
  • cover: image is sized to maintain its aspect ratio while filling the element's entire content box
  • fill: image is sized to fill the element's content box

Scene

A scene is an array of products defined with:

  • database : product 3D model guid string
  • configuration : product configuration as a string of concatenated values separated by a slash
  • animations : product animations as an array of string

Basic scenes should contain only one product.

Decor

Two ways to drive scene decor.

Integrated

When a 3D model contains integrated decors, it can be change through product configuration. For example: add ENV.STUDIO or ENV.ALPES to product configuration string.

const scene = [{
  database: 'ee294840-5689-49b0-9edb-527598602df0',
  configuration: 'Bin.Blue/Cabin.Yellow/Style.Design1/Wheels.Red/ENV.ALPES',
  animations: ['LeftDoor'],
}];

External

When a 3D model does not contain integrated decors, it can be added with an external 3D model. For example:

const decorProduct = {
  database: '82c1f7e8-9ae4-4f00-b45c-c857e21a954f',
  translation: { x: 0, y: -0.12, z: 0 },
};

const product = {
  database: 'ee294840-5689-49b0-9edb-527598602df0',
  configuration: 'Bin.Blue/Cabin.Yellow/Style.Design1/Wheels.Red',
  animations: ['LeftDoor'],
};

const scene = [decorProduct, product];

Decor product is defined with:

  • database : decor product 3D model guid string
  • translation : decor product 3D position (e.g. decorDeltaAltitude)

Note: decor product should always be the first product in the scene.

View

A view can be defined in the following modes:

Image

  • mode : image
  • camera : camera path
  • background : view background mode (product, transparent, gradient)

VRCube

  • mode : vrcube
  • camera : camera path
  • background : view background mode (product, transparent, gradient)

VRObject - animation

  • mode : vrobject
  • animation : animation name
  • camera : camera path
  • frames : number of frames
  • loop : whether animation loops or not
  • background : view background mode (product, transparent, gradient)

VRObject - bookmark set

  • mode : vrobject
  • camera : camera group path
  • background : view background mode (product, transparent, gradient)

Transition

A transition can be set when loading a scene or setting a view with:

  • fromPosition : go to specific vrobject image at the beginning - optional
  • toPosition : go to specific vrobject image at the end - optional
  • animation :
    • name: animation name
    • camera: camera path to use for animation
    • duration: animation duration in seconds
    • reverse: whether to reverse animation direction

Encoder

An encoder is defined with:

  • format : encoder format (jpeg, png, webp)
  • quality : encoder quality (0-100 for jpeg and webp and 0-9 for png)

Parameters

Render parameters are defined with:

  • antialiasing : whether software antialiasing is enabled or not
  • superSampling : super sampling coefficient 1-4

WebRender is always optimized for the following default values (false, 2). Change this with precaution !

Events

Events are defined with:

  • onLoadStart : event sent on load start
  • onLoadProgress : event sent on load progress
  • onLoadEnd : event sent on load end
  • onLoadError : event sent on load error
  • onInteraction : event sent on vrcube or vrobject interaction
  • onVrcubeInteraction : event sent on vrcube interaction
  • onVrobjectInteraction : event sent on vrobject interaction