Experiencing choppy animation on the JSFiddle? When trying to move your mouse or interact with the content, you may have come across issues with the classing related to requestAnimationFrame(this.animation). Initially, it didn't work as expected, but after seeking help on stackoverflow, I found a solution by adding
this.animate = this.animate.bind(this);
. However, this fix resulted in a significant slowdown. Is there a way to optimize performance while still utilizing the class?
Check out the JSFiddle:
https://jsfiddle.net/gentleman_goat66/o5wn3bpf/100/
Below is the code snippet:
HTML
<script type="importmap">
{
"imports":
{
"three": "https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ee9a869c8b8baedec0dfdbdfc0dd">[email protected]</a>/build/three.module.js",
"OrbitControls": "https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="77031f0512123747594642465944">[email protected]</a>/examples/jsm/controls/OrbitControls.js"
}
}
</script>
<div id="container">
</div>
JS
// JavaScript code
// Goes here...
CSS
body,html{
margin: 0;
width: 100%;
height: 100%;
}
#container {
width: 100%;
height: 100%;
background-color: black;
margin: 0;
}