         }
         
         foregroundView.alpha = 0
-        foregroundView.foldingAnimation(animationInfo.last!.type,
+        foregroundView.foldingAnimation(kCAMediaTimingFunctionEaseOut,
                                         from: CGFloat(-M_PI / 2),
                                         to: 0,
-                                        duration: animationInfo.last!.duration,
+                                        duration: durations.last!,
                                         delay:delay,
                                         hidden:false)
         

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

                let rotatedView: RotatedView = itemView as! RotatedView
                
                if index - 1 > 0 {
                    rotatedView.backView?.foldingAnimation(kCAMediaTimingFunctionEaseOut,
                        from: CGFloat(-M_PI / 2),
                        to: 0,
                        duration: durations[index-1],
                        delay: delay,
                        hidden: false)
                    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
