iOS 跷跷板动画 Seesaw Animation

Xcode Playgound示例代码:

        let testView = UIView()
        testView.frame = CGRect.init(x: 100, y: 100,  200, height: 200)
        self.view.addSubview(testView)
        testView.backgroundColor = UIColor.red
        
        var trans = CATransform3DIdentity
        trans.m34 = -1.0 / 500
        trans = CATransform3DRotate(trans, CGFloat.pi / 3, 1, 0, 0)
        UIView.animate(withDuration: 1, animations: {
            testView.layer.transform = trans
        }) { (finish) in
            UIView.animate(withDuration: 1, animations: {
                testView.layer.transform = CATransform3DIdentity
            })
        }

Ficow原创,转载请注明出处:http://www.cnblogs.com/ficow/p/8227709.html

原文地址:https://www.cnblogs.com/ficow/p/8227709.html