开发者

Flip animation only halfway through

I was wondering if it would be possible to make an animation that looks like the flip transition, but only animate it halfway through, so that the animation st开发者_Python百科ops at the moment when you you can't really see it.

Any help is greatly appreciated.


You want to animate the layer's transform property from it's default (CATransform3DIdentity) to a quarter-rotation around the Y axis. It should be something like this:

  [UIView animateWithDuration:1 animations:^{
    CATransform3D transform = CATransform3DMakeRotation(M_PI_2, 0, 1, 0);
    transform.m34 = 1.0 / -2000.0;
    self.view.layer.transform = transform;
  }];

The m34 value is how you turn on perspective for a layer. Search for "m34 perspective" for many discussions of it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜