I am making a iPhone/iPad app with a cursor and music. I am running a timer every beat and moving it like so:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:theLength];
[UIView setAnimationBeginsFromCurrentState:YES];
theCursor.frame = CGRectMake(theX, 0, 6, 320);
[UIView commitAnimations];
However, it seems to start off fast then slow down as it gets to the end. Is there any way to make the animation steady?
That's the animation curve. By default it is set to
UIViewAnimationCurveEaseInOut
. Use setAnimationCurve: to set it toUIViewAnimationCurveLinear
.You should also be aware that that way of animating is deprecated and Apple now recommend using the block-based animation style.