                 let rotatedView: RotatedView = itemView as! RotatedView
                 
                 if index - 1 > 0 {
-                    rotatedView.backView?.foldingAnimation(animationInfo[index-1].type,
+                    rotatedView.backView?.foldingAnimation(kCAMediaTimingFunctionEaseOut,
                         from: CGFloat(-M_PI / 2),
                         to: 0,
-                        duration: animationInfo[index-1].duration,
+                        duration: durations[index-1],
                         delay: delay,
                         hidden: false)
-                    delay += animationInfo[index-1].duration
-                }
-
-                
-                if index < animationInfo.count {
-                    rotatedView.foldingAnimation(animationInfo[index].type,
-                                                        from:0,
-                                                        to: CGFloat(M_PI / 2),
-                                                        duration: animationInfo[index].duration,
-                                                        delay:delay,
-                                                        hidden:true)
-                    delay += animationInfo[index].duration
+                    delay += durations[index-1]
+                }
+
+                if index < durations.count {
+                    rotatedView.foldingAnimation(kCAMediaTimingFunctionEaseIn,
+                                                    from:0,
+                                                    to: CGFloat(M_PI / 2),
+                                                    duration: durations[index],
+                                                    delay:delay,
+                                                    hidden:true)
+                    delay += durations[index]
                 }
                 
                 index += 2

    
    func closeAnimation() {
        
        let animationInfo:[(type: String, duration: NSTimeInterval)] = [
            (kCAMediaTimingFunctionEaseIn, 0.13),
            (kCAMediaTimingFunctionEaseOut, 0.13),
            
            (kCAMediaTimingFunctionEaseIn, 0.13),
            (kCAMediaTimingFunctionEaseOut, 0.13),

            (kCAMediaTimingFunctionEaseIn, 0.165), // folding open
            (kCAMediaTimingFunctionEaseOut, 0.165),
            ]
    
        var index = 0
        var delay: NSTimeInterval = 0

    
    func openAnimation() {
        
        let durations:[NSTimeInterval] = [ 0.165,
                                           0.165,
                                            0.13,
                                            0.13,
                                            0.13,
                                            0.13]
        
        
        var delay: NSTimeInterval = 0
        foregroundView.foldingAnimation(kCAMediaTimingFunctionEaseIn, from: 0, to: CGFloat(-M_PI / 2), duration: durations[0], delay:delay, hidden: true)
        
        let firstItemView = containerView.subviews.filter{$0.tag == 0}.first
        firstItemView!.layer.masksToBounds = true
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(durations[0] * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in
            firstItemView!.layer.masksToBounds = false
        }
        
