I try sth like this
btnDrive.addEventListener('click', () => {
if(confirm('Are you want to drive?')){
btnDrive.style.display = 'none';
btnBack.style.display = 'inline';
this.isDrive = true;
setTimeout(() => this.toggleCamera(), this.duration);
div.style.display = 'none';
}
});
but this is not delaying, this.duration is 5
I want to delay toggleCamera()
my logic is this:
change camera position then switch the camera to follow camera
I try firstly without after click on drive, to test if it works
and also when I ‘run’
this.isDrive = true;
it works but when I add the toggleCamera() this switching is instant I want to delay switching