Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!