mardi 5 mai 2015

Can't quite get my CGAffineTransform animation correct

I am trying to rotate a view around a semi-circle and I have the positioning and rotation of the view correct, however when I try the animation, everything gets screwed up.

Here is my code for the initial placement of the pointer:

CGAffineTransform transform = CGAffineTransformMakeTranslation(x, y);
transform = CGAffineTransformRotate(transform, radians);
self.pointerView.transform = transform;

I figured the code for the animation would be pretty much the same thing, but with an animation block, but the view to animate starts way off to the right where it is supposed to be and animates to the correct position. Not sure what I am doing wrong. Here is the animation code:

[UIView animateWithDuration:0.5 delay:0.1 options:UIViewAnimationOptionCurveEaseIn animations:^{
           CGAffineTransform atransform = CGAffineTransformMakeTranslation(x, y);
            self.pointerView.transform = CGAffineTransformRotate(atransform, radians);
        } completion:NULL];

Aucun commentaire:

Enregistrer un commentaire