Rotate Camera In Time

Hello,

I have a camera on my scene, and it rotates left if the user presses Q, and rotates right with E. How do I make the camera rotate slowly? Right now it just snaps 90 degrees, is there a way to make it rotate to 90 degrees but slowly (so you can see the camera rotate -- in other words, animate)

function Update () {
    if(Input.GetKeyDown("q")){
        transform.Rotate(Vector3.up * -90);
    }
    if(Input.GetKeyDown("e")){
        transform.Rotate(Vector3.up * 90);
    }
}

Use the key presses to set your target rotation, not your actual rotation, then lerp towards your target each frame.

Something like this ...

float damping = 2.0f;
float rotate = Mathf.Lerp(transform.localEulerAngles.y, targetRotate, damping * Time.deltaTime);
transform.Rotate(Vector3.up * rotate);