const autoRotateBtn = document.getElementById('autoRotateBtn');
let isAutoRotating = false;
function initControls(controls) {
autoRotateBtn.addEventListener('click', () => {
isAutoRotating = !isAutoRotating;
controls.autoRotate = isAutoRotating;
autoRotateBtn.style.background = isAutoRotating
? 'rgba(0,200,100,0.8)'
: 'rgba(0,150,255,0.8)';
});
}
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
const controls = new OrbitControls(camera, renderer.domElement);
initControls(controls);