33React components to view STL and OBJ models.
44Based on THREE.js and [ react-stl-viewer] ( https://github.com/chiedolabs/react-stl-viewer )
55
6+ ### [ Live Demo] ( https://bohdanbirdie.github.io/stl-obj-demo/ ) .
67
78## How to use
8- 1 . Use OBJ or STL loader
9+ 1 . Install the app
10+ - via npm ``` npm install react-stl-obj-viewer --save ```
11+ - via yarn ``` yarn add react-stl-obj-viewer ```
12+
13+ 2 . Use OBJ or STL loader
914
1015 ``` import {OBJViewer, STLViewer} from 'npm-react-component-starter'; ```
11- 2 . Pass props to viewers:
16+ 3 . Pass props to viewers:
1217
1318```
1419static propTypes = {
@@ -20,6 +25,8 @@ static propTypes = {
2025 height: PropTypes.number, // Height of rendered area
2126 backgroundColor: PropTypes.string, // Scene background color
2227 modelColor: PropTypes.string,// Model color(textures unsupported)
28+ sceneClassName: PropTypes.string, // Class name for rendered canvas scene
29+ onSceneRendered: PropTypes.func, // Callback for rendered scene ready
2330 };
2431```
2532Default props
@@ -29,12 +36,11 @@ static defaultProps = {
2936 modelColor: '#B92C2C',
3037 height: 400,
3138 width: 400,
39+ sceneClassName: '',
3240 };
3341```
3442
3543## Convert scene to screenshot
3644
3745Simply get your element _ (canvas scene)_ by any selector and call ` .toDataURL("image/png") ` on it.
3846___
39-
40- ## [ Live Demo] ( https://bohdanbirdie.github.io/stl-obj-demo/ ) .
0 commit comments