IOS: Ken Burns animation implementation requires unexpected options

I have a UIImageView. I am trying to animate pan / zoom similar to Ken Burns. I want to focus on the face (in particular, say, at the end of the nose) and zoom out to the full size of the image. The code looks something like this:

image.frame = // some frame that zooms in on the image;
image.center = // tip of the nose

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:3];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

image.frame = // original frame
image.center = // original centerpoint

[UIView commitAnimations];

In Photoshop, the tip of the nasal coordinates is completely different from the values ​​I had to break through in the above code to actually center the image on the nose when the animation starts. I tried to flip the axes by multiplying by a scale factor ... and I cannot understand why the iOS numbers are significant v. The ones I deduced from Photoshop.

Can someone point out a mismatch between the two coordinate systems?

Additional Information:

  • image UIImageView UIViewController
  • UIViewController - .
+3
2

, . , .

EDIT: , CoreAnimation .

+3

, . , , . . , [self performSelector: withObject: afterDelay:], ( [UIView * animation]).

, .

- (void)one {
    image.frame = // some frame that zooms in on the image;
    image.center = // tip of the nose

    [self performSelector:@selector(two) withObject:nil afterDelay:0];
}

- (void)two {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:3];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    image.frame = // original frame
    image.center = // original centerpoint

    [UIView commitAnimations];
}
+2

Source: https://habr.com/ru/post/1794886/


All Articles