开发者

Flip animation only halfway through

开发者 https://www.devze.com 2023-04-08 18:12 出处:网络
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 momentwhen yo

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

精彩评论

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