|
1 | 1 | import * as THREE from 'three';
|
2 |
| -import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'; |
3 |
| -import Stats from 'three/examples/jsm/libs/stats.module.js'; |
| 2 | +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; |
| 3 | +import Stats from 'three/addons/libs/stats.module.js'; |
4 | 4 |
|
5 | 5 | import testcard from '../assets/testcard.jpg';
|
6 | 6 |
|
7 | 7 | /*
|
8 |
| -
|
9 |
| - Main Three.js code |
10 |
| -
|
11 |
| - A rotating cube with orbit controls and stats. This is a vanilla JS ES6 module, |
12 |
| - as used in the threejs examples. threejs loaded via NPM. |
13 |
| -
|
14 |
| - Assets can be loaded via imports (see testcard above), or directly from |
15 |
| - public folder by using something like: process.env.PUBLIC_URL + '/assets/testcard.jpg' |
16 |
| - https://create-react-app.dev/docs/using-the-public-folder/ |
17 |
| - |
| 8 | + Main Three.js code. A rotating cube with orbit controls and stats. |
| 9 | + This is a vanilla JS ES6 module, as used in the threejs examples. |
| 10 | + Assets can be loaded via imports (see testcard.jpg above). |
18 | 11 | */
|
19 | 12 |
|
20 | 13 | console.log('THREE version', THREE.REVISION);
|
@@ -58,15 +51,9 @@ export function init(canvas) {
|
58 | 51 | }
|
59 | 52 |
|
60 | 53 | function update() {
|
61 |
| - //console.log('threejs update'); |
62 | 54 | raf = requestAnimationFrame(update);
|
63 |
| - |
64 |
| - //if (speed !== undefined) { |
65 |
| - //console.log(cube.rotation.x, props.props.speedX); |
66 | 55 | cube.rotation.x += Number(props.speedX) / 20;
|
67 | 56 | cube.rotation.y += Number(props.speedY) / 20;
|
68 |
| - //} |
69 |
| - // cube.rotation.y += speed / 10; |
70 | 57 | renderer.render(scene, camera);
|
71 | 58 | stats.update();
|
72 | 59 | controls.update();
|
|
0 commit comments