How to delay the camera switching?

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

@grzesiekmq in set timeout the duration should be in milliseconds.

1 Like

ah… yes xD