var scene, camera, renderer;
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.1,
1000
);
scene.background = new THREE.Color("#111214");
camera.position.set(100, 100, 100);
renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
var avtar;
var loader = new THREE.GLTFLoader();
loader.load("name.gltf", function (gltf) {
avtar = gltf.scene;
scene.add(avtar);
});
controls = new THREE.OrbitControls(camera, renderer.domElement);
document.onkeydown = function (e) {
switch (e.keyCode) {
case 37:
avtar.scale.z += 0.1;
break;
case 39:
avtar.scale.z -= 0.1;
break;
}
};
function animate() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
}
animate();
}
init();