i am making a game in which when user makes a move the source and destination squares light up in an animation.The animation duration is 1 sec.
The problem is when user taps on forward button too quickly all source and destination squares light up leading to many light up squares happening due to second animation starting before the first one ends.
How can i abruptly end a animation when its duration is not over.
animation function code :-
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:value];
[UIView setAnimationRepeatCount:1];
// [UIView setAnimationRepeatAutoreverses:YES];
[self.view viewWithTag:(src+1)+2000].backgroundColor=[UIColor orangeColor];
[self.view viewWithTag:(src+1)+2000].backgroundColor=[UIColor clearColor];
[self.view viewWithTag:(dest+1)+2000].backgroundColor=[UIColor orangeColor];
[self.view viewWithTag:(dest+1)+2000].backgroundColor=[UIColor clearColor];
[UIView commitAnimations];
Note :- I accept down vote as a healthy way of criticism but do write the reason so that i can improve
use
hope it helps. happy coding 🙂