How to restrict animation to be displayed only onc

Hi, being a begineer i am facing some problems in the given below program as follow
i am making a program to animate a ball over a field it goes like,

void display() {
/* code to draw a field /
loop:1 to 5
loop:1 to 6
/
here comes the code to animate the ball over the field */
}
I want whenever user press “right_Arrow” the whole scene get rotated by some angle problem:whenever the user presses “right_Arrow” key it rotate the scene by some angle but also display whole animation again…but i want animation to be displayed only once(after maximazing window) and then the user can rotate the whole scene
by some angle without displaying any animation on pressing “right_Arrow” key
How should i do this in my code?