Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

GLTF position three.js

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();
Comment

PREVIOUS NEXT
Code Example
Javascript :: repidme 
Javascript :: js The equivalent of destructuring arrays and objects 
Javascript :: react native paper status bar color 
Javascript :: javascript find in array cannot read property of undefined 
Javascript :: Get even numbers with VanillaJS 
Javascript :: Alternative Syntax For Backbone Simple Template 
Javascript :: cypress json no videos 
Javascript :: how to return the entire array x+1 in javascript 
Javascript :: infinite loop MenuItem MUI fixed onClick event 
Javascript :: Remove the minimum 
Javascript :: Angular active router change event 
Javascript :: scroll to bottom of page javascript 
Javascript :: react extends component App.defaultProps 
Javascript :: Create a new object where the prototype is {0:10} 
Javascript :: When defined as a method of an object, in a regular function this refers to the object 
Javascript :: invalid json text mysql 
Javascript :: new date is not working in react js 
Javascript :: stuck at "resvoling packages" 
Javascript :: without the filter() method 
Javascript :: Register Multiple Models In Admin 
Javascript :: Parsing the URL string using the WHATWG API 
Javascript :: uninstall spicetify 
Javascript :: js Changing selected option by option id, class, or attribute 
Javascript :: react native avoid keyboard when multiline 
Javascript :: click mouseup mousedown 
Javascript :: modify an array in javascript using function method 
Javascript :: express check request type 
Javascript :: getting-host-is-not-configured-error-when-using-next-image 
Javascript :: submit form on ctrl enter 
Javascript :: function solution(n) { } 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =