1.1.3 • Published 1 year ago

react-3d-model-component v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-3d-model-component

npm.io

A react component to view a single 3D model in STL format using three.js.

Check it out here!

Features

The 3D model viewer has a lot of configurations!

  • Unlimited point lights and directional lights
  • Full camera positioning customization
  • Built-in object inspector
  • Built-in auto-rotation
  • Single React component

Usage

Install react-3d-model-component through npm

npm i react-3d-model-component

Use ModelViewer component

import ModelViewer from "react-3d-model-component";

Properties

PropertyTypeDefaultDescription
urlstringnoneThe url of the STL file, can also be a URL object
widthstring"1000px"The width of the canvas
heightstring"500px"The height of the canvas
backgroundColorstring"lightgray"The canvas color
colorstring"lightblue"The object color
objectPositioninteger array0, 0, 0The position of the object x, y, z
initObjectRotationinteger array-MATH.pi / 2, 0, 0The initial rotation of the object
rotatebooleantrueObject auto-rotation
rotationSpeedsinteger array0, 0, 0.005Object auto-rotation speeds x, y, z
cameraPositionarray100, 100, 100Camera position
fovinteger30Field of view
returnCamerabooleantrueReturn camera on orbit controls camera movement
pointLightsinteger array array[100, 100, 100]Array of arrays where each sub-array is the coordinates for the point lights
directionalLightsinteger array array[]Array of arrays where each sub-array is the coordinates for the directional lights
ambientLightIntensityfloat0.3Intensity of ambient light
axesbooleanfalseShow threejs AxesHelper