const renderer = new THREE.WebGLRenderer();
const scene = new THREE.Scene();
const camera =new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
1,
1000
);
camera.position.z = 1;
let mesh;
renderer.setSize(window.innerWidth, window.innerHeight);
scene.background = new THREE.Color(0xeff5555);
scene.add(new THREE.HemisphereLight(0xffffcc, 0x333399, 1.0));
camera.position.z = 3;
camera.position.y = 15;
new GLTFLoader().load('/images/content/iphone.glb', ({ scene: model }, animations) => {
scene.add(model);
model.scale.setScalar(1);
camera.lookAt(model.position);
mesh = model;
mesh.scale.set( 10, 10, 10 );
});
const animate = () => {
if (mesh) {
mesh.rotation.y = 0;
mesh.rotation.x = 0;
mesh.position.y = 0;
mesh.position.x = 0;
}
renderer.render(scene, camera);
requestAnimationFrame(animate);
};
animate();
document.body.appendChild(renderer.domElement);