         foregroundTopConstraint!.constant += foregroundView.bounds.height / 2
         foregroundView.layer.transform = foregroundView.transform3d()
         
-        
-        // elements view
-        
-        for constraint in containerView.constraints {
-            if constraint.identifier == "yPosition" {
-                constraint.constant -= constraint.firstItem.bounds.height / 2
-                constraint.firstItem.layer.anchorPoint = CGPoint.init(x: 0.5, y: 0)
-                constraint.firstItem.layer.transform = constraint.firstItem.transform3d()
-            }
-        }
-        
         createAnimationView();
 
         self.contentView.bringSubviewToFront(foregroundView)
-        
-//        // added back view
-//        var previusView: RotatedView?
-//        for contener in containerView.subviews.sort({ $0.tag < $1.tag }) {
-//            if contener is RotatedView && contener.tag > 0 && contener.tag < containerView.subviews.count {
-//                let rotatedView = contener as! RotatedView
-//                previusView?.addBackView(rotatedView.bounds.size.height, color: backViewColor)
-//                previusView = rotatedView
-//            }
-//        }
     }
     
     func createAnimationItemView()->[RotatedView] {
         var items = [RotatedView]()
         items.append(foregroundView)
         var rotatedViews = [RotatedView]()
-        for itemView in containerView.subviews.filter({$0 is RotatedView}).sort({ $0.tag < $1.tag }) as! [RotatedView] {
+        for itemView in animationView!.subviews.filter({$0 is RotatedView}).sort({ $0.tag < $1.tag }) as! [RotatedView] {
             rotatedViews.append(itemView)
             if itemView.backView != nil {
                 rotatedViews.append(itemView.backView!)

    }
    
    func openAnimation(completion completion: CompletionHandler?) {
        if animationView?.subviews.count == 0 {
            addImageItemsToAnimationView()
        }
        
        let durations = durationSequence(.Open)
        

            firstItemView!.layer.masksToBounds = false
        }
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in
            self.animationView?.alpha = 0
            self.containerView.alpha = 1
            completion?()
        }
    }
    
    func closeAnimation(completion completion: CompletionHandler?) {
        
        if animationView?.subviews.count == 0 { // added animation items if need
            addImageItemsToAnimationView()
        }
        
        animationView?.alpha = 1;
        containerView.alpha = 0;
        
        var durations = durationSequence(.Close)
        durations = durations.reverse()
