       circle.hideAnimation(0.5, delay: duration) { [weak self] _ in
         if self?.platform?.superview != nil { self?.platform?.removeFromSuperview() }
       }
-      
+
       hideCenterButton(duration: 0.3)
       showCenterButton(duration: 0.525, delay: duration)
 
       if customNormalIconView != nil && customSelectedIconView != nil {
-        
+
         DispatchQueue.main.asyncAfter(deadline: .now() + duration, execute: {
           self.delegate?.circleMenu?(self, buttonDidSelected: sender, atIndex: sender.tag)
         })
       }
     }
   }
-  
+
   // MARK: animations
-  
+
   fileprivate func buttonsAnimationIsShow(isShow: Bool, duration: Double, hideDelay: Double = 0) {
     guard let buttons = self.buttons else {
       return
     }
-    
+
     let step: Float = 360.0 / Float(self.buttonsCount)
     for index in 0..<self.buttonsCount {
       guard case let button as CircleMenuButton = buttons[index] else { continue }
       let angle: Float = Float(index) * step
       if isShow == true {
         delegate?.circleMenu?(self, willDisplay: button, atIndex: index)
-        
+
         button.rotatedZ(angle: angle, animated: false, delay: Double(index) * showDelay)
         button.showAnimation(distance: distance, duration: duration, delay: Double(index) * showDelay)
       } else {
         button.hideAnimation(
           distance: Float(self.bounds.size.height / 2.0),
           duration: duration, delay: hideDelay)
-        self.delegate?.menuCollapsed?(self)
       }
     }
     if isShow == false { // hide buttons and remove
       self.buttons = nil
-
+      self.delegate?.menuCollapsed?(self)
       DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + duration) {
         if self.platform?.superview != nil { self.platform?.removeFromSuperview() }
       }
     }
   }
-  
+
   fileprivate func tapBounceAnimation() {
     self.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
     UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.3, initialSpringVelocity: 5,

    }
    return true
  }
  
  // MARK: create
  fileprivate func createButtons(platform: UIView) -> [UIButton] {
    var buttons = [UIButton]()
    
    let step: Float = 360.0 / Float(self.buttonsCount)
    for index in 0..<self.buttonsCount {
      
      let angle: Float = Float(index) * step
      let distance = Float(self.bounds.size.height/2.0)
      let button = Init(CircleMenuButton(size: self.bounds.size, platform: platform, distance:distance, angle: angle)) {

  var radians: Float {
    return self * (Float(180) / Float(M_PI))
  }

  var degrees: Float {
    return self  * Float(M_PI) / 180.0
  }
}

internal extension UIView {

  var angleZ: Float {
    return atan2(Float(self.transform.b), Float(self.transform.a)).radians
  }
