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

113
Vistas
Stats.js getting displayed in other canvas as ThreeJS

Doing my first steps with Three.js and wanted to display the Stats.js in an little test-scenario.

https://codepen.io/B33THR333/pen/ExwLbON

I didn't want to use modules for now, but besides that i pretty much used the same code as in the examples:

    var stats = new Stats(); 
    var renderer = new THREE.WebGLRenderer({antialias: true});
    container.appendChild(stats.domElement);
    renderer.setSize(window.innerWidth,window.innerHeight);
    renderer.setPixelRatio( window.devicePixelRatio );
    container.appendChild(renderer.domElement);

still the Stats seem to be displayed in a different canvas (whitespace on top) and I don't see where I went wrong here. Has anyone an idea?

Would be really thankful for any input!

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

0

You're appending two separate elements to your container div. If you want them to overlap so it appears like the stats canvas is part of the renderer, you just need some basic CSS:

#container {
  position: relative;
}

#container > div {
  position: absolute;  
}
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