Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

251
Vistas
I can't see the object in Three.js

So I'm trying to make a portafolio with three.js. The problem is that I can't see the object in the page and I don't know what is wrong with my code. here is the project https://codepen.io/BernardoOlisan/pen/vYJmpVZ What is wrong with my code?

<h1>Three.js</h1>
<canvas id="bg"></canvas>

CSS

canvas {
  position: relative;
  width: 100%;
  top: 200px;
}

JS

    // Main js for Three.js seciton work
import * as THREE from "https://cdn.skypack.dev/three";

const scene = new THREE.Scene();

const camera = new THREE.PerspectiveCamera( 75, window.ineerWidth / window.innerHeight, 0.1, 1000 );

const renderer = new THREE.WebGLRenderer({
  canvas: document.querySelector('#bg'),
});

renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
camera.position.setZ(30);

renderer.render( scene, camera)

const geometry = new THREE.TorusGeometry( 10, 3, 16, 100 )
const material = new THREE.MeshBasicMaterial( { color: 0xFF6347 } );
const torus = new THREE.Mesh( geometry, material );

scene.add(torus)

function animate() {
  requestAnimationFrame( animate );
  renderer.render( scene, camera );
}

animate()
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Just a typo at window.ineerWidth

const camera = new THREE.PerspectiveCamera( 75, window.ineerWidth / window.innerHeight, 0.1, 1000 );

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda