Skip to content

Commit b142c36

Browse files
authored
Update script.js
1 parent 68de721 commit b142c36

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

script.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
11
import * as THREE from 'three';
22

3-
const scene = new THREE.Scene();
4-
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
5-
6-
const renderer = new THREE.WebGLRenderer();
7-
renderer.setSize( window.innerWidth, window.innerHeight );
8-
document.body.appendChild( renderer.domElement );
9-
10-
const geometry = new THREE.BoxGeometry( 1, 1, 1 );
11-
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
12-
const cube = new THREE.Mesh( geometry, material );
13-
scene.add( cube );
14-
15-
camera.position.z = 5;
16-
17-
function animate() {
18-
cube.rotation.x += 0.01;
19-
cube.rotation.y += 0.01;
20-
renderer.render( scene, camera );
21-
}
22-
renderer.setAnimationLoop( animate );
23-
243
const input = document.getElementById("input");
254
const preview = document.getElementById("preview");
265
const threedee = document.getElementById('threedee');
@@ -596,3 +575,24 @@ function appendErrorMessage(message) {
596575
errorParagraph.textContent = message;
597576
errorOutput.appendChild(errorParagraph);
598577
}
578+
579+
const scene = new THREE.Scene();
580+
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
581+
582+
const renderer = new THREE.WebGLRenderer();
583+
renderer.setSize( window.innerWidth, window.innerHeight );
584+
document.getElementById('threedee').appendChild( renderer.domElement );
585+
586+
const geometry = new THREE.BoxGeometry( 1, 1, 1 );
587+
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
588+
const cube = new THREE.Mesh( geometry, material );
589+
scene.add( cube );
590+
591+
camera.position.z = 5;
592+
593+
function animate() {
594+
cube.rotation.x += 0.01;
595+
cube.rotation.y += 0.01;
596+
renderer.render( scene, camera );
597+
}
598+
renderer.setAnimationLoop( animate );

0 commit comments

Comments
 (0)