camera idle animation

So i just need a good way to get my camera to move around , code or animation - but ONLY when no animations are playing or any button are being pressed …

i guessing this , out of my head (im not very good at coding )

var camAnimation : Animation;

function camIdle () {


   if(I dont how to say if no buttons are being pressed){
      animation.Play(camAnimation);

    {
    else
    }

    if(GetButton(AnyKey or what ever it is)){
       animation.Stop(camAnimation);

}



}

function camIdle()
{
if (!Input.anyKey) { // Check if there are no keys being pressed.
if(!animation.IsPlaying(“MyAnimation”)) { // If so, check if the animation is not playing.
animation.Play(“MyAnimation”); // If it isn’t, play it.
}
}
else {
// One or more keys were pressed, stop playing the animation.
animation.Stop(“MyAnimation”);
}
}

function Update()
{
	camIdle();
};

if(!Input.anyKey)
{
animation.Play(camAnimation);
}