Rotation animation

i've been trying have camera rotation animation upon keypress,

like so:

perform a 90deg rotation on camera (make it look left or right) upon a keypress,

but i would like it to be an animation: make the rotation in few secs… says 5 seconds to complete the 90deg rotation

so the user press one key one time, and the camera will perform a 90deg rotation in 5 sec to it's left or right (depending key pressed) on it's own.

any suggestions , advices how to do that?



or how to simulate a user keypress ? (for 5 seconds)

I think this will help; Parametric Equation of a Circle.

x = a + rcos(t)

y = b + r

(1), Wikipedia

(2), Wolfram

Limit t to 0 to 90deg.

You could also use a CameraNode and a SpatialTransformer. 

See TestCameraNode and TestSpatialTransformer for details.