IOS swift的动画效果及实现方法

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

    //点击屏幕的事件  
       override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {  
           //自定义动画效果  
           func anim(){  
               img1.alpha=0.1  
               img1.center=CGPoint(x: 0.0, y: 0.0)  
           }  
           func completion(v:Bool){  
               println("anim completion\(v):\(falg)")  
           }  
             
           UIView.transitionWithView(img1, duration: 1.0, options: UIViewAnimationOptions.TransitionNone, animations: anim, completion: completion)  
             
             
             //视图动画效果 3步  1:开始动画 2:配置动画  3:提交动画  
             UIView.beginAnimations(nil, context: nil)  
             UIView.setAnimationTransition(UIViewAnimationTransition.CurlDown, forView: img1, cache: true)  
             UIView.setAnimationDuration(1.0)  
             UIView.commitAnimations()  
             
             
           //视图的切换  
             
           if falg{  
               falg=false  
               /*视图切换 
               fromView 开始视图 
               toView 结束视图 
               duration 效果时间 
               options 动画效果模式 
               completion 回调方法 
               */  
               UIView.transitionFromView(img2, toView: img1, duration: 1.0, options: UIViewAnimationOptions.TransitionFlipFromRight, completion: completion)  
           }else{  
               falg=true  
               UIView.transitionFromView(img1, toView: img2, duration: 1.0, options: UIViewAnimationOptions.TransitionFlipFromLeft, completion: completion)  
           }  
             
       }