all code loads fine until the last line animate(); i get a console error Uncaught ReferenceError: animate is not defined,
const { THREE } = window;
// Create a scene
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
50, window.innerWidth / window.innerHeight, 0.1, 1000
);
const renderer = new THREE.WebGLRenderer();
renderer.setClearColor(0xdfdfdf);
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
camera.position.z = 300;
// OrbitControls
var controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.campingFactor = 0.25;
controls.enableZomm = true;
// Add a directional light to the scene
const directionalLight = new THREE.DirectionalLight(0xffffff, 0.5);
scene.add(directionalLight);
// Add an ambient light to the scene
const ambientLight = new THREE.AmbientLight(0xFFffff, 0.5);
ambientLight.position.set( 25, 25, 25 );
scene.add(ambientLight);
const pointLight = new THREE.PointLight(0xffffff, 0.5);
pointLight.position.set( 25, 25, 25 );
scene.add(pointLight);
var gltfLoader = new THREE.GLTFLoader();
gltfLoader.load(
// resource URL
'obj/PM_Baked_Idea_4-21-20_05.glb',
// called when the resource is loaded
function ( gltf ) {
scene.add( gltf.scene );
}),
function animate() {
requestAnimationFrame(animate);
controls.update();
renderer.render(scene, camera);
}
animate();