Threejs Camera animation not working.....please help

Im trying to animate the camera to a desired position on scroll. But the 3D object disappears as soon as the scroll event is triggered. Heres the code.

function animate() {

         TWEEN.update();

         render();

    renderer.render(scene,camera);

    requestAnimationFrame(animate);

  }

 

  function onDocumentMouseMove( event ) {

x=1;

mouseX = ( event.clientX - windowHalfX ) * 0.6; //0.5 to set how much angle to tilt

mouseY = ( event.clientY - windowHalfY ) * 0.2;

mouseZ = ( event.clientX - windowHalfX ) * 0.15;

}

function render() {

           if(x==1){

            camera.position.x += ( -mouseX - camera.position.x ) * .05;

            camera.position.y += ( -mouseY - camera.position.y ) * .05;

            if(mouseZ>0){

          camera.position.z += (  mouseZ - camera.position.z * 0.3 ) - 200; 

            }

            if(mouseZ<0){

          camera.position.z += (-  mouseZ - camera.position.z * 0.3 ) - 200; 

            }              

}

camera.lookAt( scene.position );

}

function updateCamera(event) {

    counter++

    console.log(counter);

        

if(event.deltaY>=1){

     x = 0;

    document.removeEventListener( 'mousemove', onDocumentMouseMove);

                  

if(counter>=1){

    counter=0;

    /* for(var i = 0; i<=5; i++ ){

camera.position.x += 100;

break;

    }*/

    
    

var posX = 0;

var posY = -80;

var posZ = -400;

 var from = {

        x: camera.position.x,

        y: camera.position.y,

        z: camera.position.z

    };

    var to = {

        x: posX,

        y: posY,

        z: posZ

    };

var tween = new TWEEN.Tween(from)

        .to(to, 600)

        .easing(TWEEN.Easing.Linear.None)

        

        .onUpdate(function () {

        camera.position.set(this.x, this.y, this.z);

        camera.lookAt(new THREE.Vector3(0, 0, 0));

    })

    .onComplete(function() {

                    camera.lookAt(new THREE.Vector3(0, 0, 0));

                })

        .start(); 

}

} 



     if(event.deltaY<=1) {camera.position.set(0,100,-600);

     counter=0;

         x = 1;

    document.addEventListener( 'mousemove', onDocumentMouseMove);

}

}