I am a new three.js user and still learning Javascript. I successfully completed the "Getting Started" project on threejs.org, which consisted of a rotating cube, with no issues. However, when I attempted to add a wireframe to the project, it suddenly stopped working.
Can someone please assist me in identifying what went wrong? The code snippet is provided below.
Thank you!
<html>
<head>
<title>My first Three.js app</title>
<style>
body { margin: 0; } canvas { width: 100%; height: 100% }
</style>
</head>
<body>
<script src="http://threejs.org/build/three.min.js"></script>
<script>
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );
var renderer = new THREE.WebGLRenderer(); renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 );
material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
object = new THREE.Mesh( geometry, material );
wireframe = new THREE.WireframeHelper( object, 0x00ff00 );
scene.add( object );
scene.add( wireframe );
camera.position.z = 5;
var render = function () {
requestAnimationFrame( render );
cube.rotation.x += 0.05;
cube.rotation.y += 0.05;
renderer.render(scene, camera);
};
render();
</script>
</body>
</html>