Gire un UIView hacia la derecha para un ángulo mayor de 180 grados
Estoy animando un brazo del reloj desde las 12 en punto hasta la hora actual. Si se trata de las 11 en punto, quiero que el brazo gire en el sentido de las agujas del reloj hasta las 11 en punto. Pero claro si uso:
CGAffineTransform rotation = CGAffineTransformMakeRotation(2*M_PI*11/12);
[UIView animateWithDuration:3.0
animations:^{
clockArm.transform = rotation;
}];
la rotación va en sentido contrario a las agujas del reloj. Lo intenté:
CGFloat angle = 2*M_PI*11/12;
CGAffineTransform firstRotation = CGAffineTransformMakeRotation(M_PI-0.001);
CGFloat firstRotationTime = 3.0*(M_PI/angle);
CGAffineTransform secondRotation = CGAffineTransformMakeRotation(angle);
CGFloat secondRotationTime = 3.0 - firstRotationTime;
[UIView animateWithDuration:firstRotationTime
delay:0.0
options:UIViewAnimationCurveLinear
animations:^{
self.clockArm1.transform = firstRotation;
}
completion:^(BOOL finished) {
[UIView animateWithDuration:secondRotationTime
delay:0.0
options:UIViewAnimationCurveLinear
animations:^{
self.clockArm1.transform = secondRotation;
}
completion:^(BOOL finished){
}];
}];
La animación va en el sentido de las agujas del reloj, pero está entrecortada: la animación todavía parece estar haciendo un UIViewAnimationEaseInOut para la primera animación. ¿Qué estoy haciendo mal, o hay otra manera de lograr lo que quiero?