0

我想做动画就像下面的链接一样:

https://dribbble.com/shots/4853929-View-Photos

我也尝试了许多第 3 方库,但并没有像上面的链接那样获得完全的动画。

var rotationAndPerspectiveTransform: CATransform3D = CATransform3DIdentity
        rotationAndPerspectiveTransform.m34 = 1.0 / -10000.0
        rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, -.pi * 0.1, 2.0, 0.0, 0.1)

        UIView.animateKeyframes(withDuration: 2, delay: 0, options: .calculationModeCubic, animations: {
            UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: 0.5) {

                self.customHeader?.collectionView.frame = CGRect(x: 0.0, y: 0.0, width: self.view.frame.size.width, height: self.view.frame.size.height)
                self.customHeader?.layer.transform = rotationAndPerspectiveTransform;
            }
            UIView.addKeyframe(withRelativeStartTime: 0.5, relativeDuration: 0.5) {
                self.customHeader?.collectionView.frame = CGRect(x: 0.0, y: 0.0, width: self.view.frame.size.width, height: self.view.frame.size.height)
                self.customHeader?.layer.transform =  CATransform3DIdentity

            }

        }, completion: nil)

一些机构帮我解决它。

或者建议我任何第三方图书馆。

4

0 回答 0