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

@standard/view

v1.0.5

Published

3D Graphics Library for React Apps

Downloads

11

Readme

Standard View

Usage

Install

$ npm install @standard/view

Place Views into your React App. For example:

import { View3D, Box } from '@standard/view';
.
.
.
<View3D>
  <Box position={[1, 0, 0]} color="green" />
  <Box position={[-1, 0, 0]} color="red" />
</View3D>

For details about valid properties, look at the interfaces named *Props, where * is the component name, in src/primitves/ and src/groups/.

Stories

yarn storybook to see stories of each component in standard-view. You may also visit Standard View Storybook served with netlify.

Examples

create-react-app to Standard View Project

Fit to Window

Set .App canvas in css file to adjust Standard View View3D canvas.

Intellisense

For VSCode, press ctrl + space to force load intellisense at cursor location.

Standard View Components

Primitives

  • Mesh
  • Box
  • Camera
  • Circle
  • Cylinder
  • Plane
  • Polygon
  • Quad
  • Sphere
  • Triangle

Groups

  • Group
  • Arrow
  • Axis
  • Capsule
  • GLTF
  • OBJ
  • PCD

Lines

  • Line
  • BoundingBox (Group)

Texts

  • Text (Mesh)
  • Label (Mesh)

Lights

  • AmbientLight
  • DirectionalLight
  • HemisphereLight
  • PointLight
  • SpotLight

Views

  • View3D

Mesh

All Standard View primitives are composed within Mesh, with the exception of Line, BoundingBox, Text, and Group. Therefore, properties of Mesh are common to nearly alll components. Here is a list of explicitly managed Mesh properties in Standard View:

Mesh Properties

  • position: Array<number>
  • scale: Array<number>
  • rotation: Array<number>
  • quaternion: Array<number>

Material Properties

  • color: string
  • hoverColor: string
  • opacity: number
  • texturePath: string
  • textureURL: string
  • material: THREE.Material

Geometry Properties

  • wireframe: boolean
  • side: number
  • geometry: THREE.Geometry

Animation Properties

  • animation: Function
  • state: Object

Event Properties

  • onClick: Function
  • onDoubleClick: Function
  • onWheel: Function
  • onPointerUp: Function
  • onPointerDown: Function
  • onPointerOver: Function
  • onPointerOut: Function
  • onPointerMove: Function

Mesh can also support animations via the animation property. A function with one argument that may be destructured to include state, setState, mesh, and any Canvas properties desired for the animation. All primitives and shapes may have animation. These animations are reactive, so they incur many render calls, but also maintain react-three-renderer's native raycasting for the event property functions.

Mesh also exposes react-three-fiber's the event property functions but with a constrained argument set, similar to animation. All event property functions take one arguement that may be destructured to include mesh, state, setState, and any Canvas prop. The benefit of this design, just like animations, is that a reference to mesh is automatically provided. Moreover, react-three-fiber's Canvas state properties are exposed. This allows event functions to reach right into the react-three-fiber/three.js's scene, camera, gl, etc. Hence all shapes that are Meshs may have these event property functions.

Of course, Mesh can accept properties handled by react-three-fiber/three.js as well. After explicitly managing these properties, remaining properties are passed to react-three-fiber's mesh. (Mesh is a wrapper of react-three-fiber's mesh, which is a wrapper of THREE.Mesh.)

View3D

Here is a list of explicitly managed View3D properties in Standard View:

WebGLRenderer Properties

  • background: string

Camera Control Properties

  • trackballControls: boolean
  • orbitControls: boolean
  • mapControls: boolean

Of course, View3D can accept Canvas properties handled by react-three-fiber as well. The Standard View properties are handled and stripped away before passing the properties to Canvas. (View3D is a wrapper of react-three-fiber's Canvas.)

Text

Text in Standard View is composed within a Mesh. So Text may accept all the same properties as a Mesh. Text also should have a text property with the desired string to be displayed and also a font or fontName. fonts are typeface.json fonts and must be a THREE.Font. The default three.js fonts are also included in Standard View, so simply passing fontName with one of those fonts will work.

Fonts

  • helvetiker
  • helvetikerBold
  • optimer
  • optimerBold
  • gentilis
  • gentilisBold

In general Text will be much more computation expensive to render compared to Label which is just a Plane with a texture of the desired text.

react-three-fiber

Checkout react-three-fiber's page for more details.