Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda