時計の腕を12時の方向から現在の時刻に向けてアニメートしています。11時と言えば、腕を時計回りに11時の位置まで回転させたいです。しかしもちろん、私が使用する場合:
CGAffineTransform rotation = CGAffineTransformMakeRotation(2*M_PI*11/12);
[UIView animateWithDuration:3.0
animations:^{
clockArm.transform = rotation;
}];
回転は反時計回りに進みます。私は試した:
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){
}];
}];
アニメーションは時計回りに進みますが、途切れがちです。アニメーションは、最初のアニメーションに対してUIViewAnimationEaseInOutを実行しているようです。私は何を間違っているのですか、それとも私が望むことを達成するための別の方法がありますか?