 import UIKit
 
 public class BouncyLayout: UICollectionViewFlowLayout {
+    
+    public enum BounceStyle {
+        case subtle
+        case regular
+        case prominent
+        
+        var damping: CGFloat {
+            switch self {
+            case .subtle: return 1
+            case .regular: return 0.75
+            case .prominent: return 0.5
+            }
+        }
+        
+        var frequency: CGFloat {
+            switch self {
+            case .subtle: return 2
+            case .regular: return 1.5
+            case .prominent: return 1
+            }
+        }
+    }
+    
+    private var damping: CGFloat = BounceStyle.regular.damping
+    private var frequency: CGFloat = BounceStyle.regular.frequency
+    
+    public convenience init(style: BounceStyle) {
+        self.init()
+        
+        damping = style.damping
+        frequency = style.frequency
+    }
+    
+    public convenience init(damping: CGFloat, frequency: CGFloat) {
+        self.init()
+        
+        self.damping = damping
+        self.frequency = frequency
+    }
     
     private lazy var animator: UIDynamicAnimator = UIDynamicAnimator(collectionViewLayout: self)
     

        super.prepare()
        guard let view = collectionView, let attributes = super.layoutAttributesForElements(in: view.bounds)?.flatMap({ $0.copy() as? UICollectionViewLayoutAttributes }) else { return }
        
        oldBehaviors(for: attributes).forEach(animator.removeBehavior(_:))
        newBehaviors(for: attributes).forEach {
            $0.damping = 0.7
            $0.frequency = 1.5
            animator.addBehavior($0)
        }
    }
    
    private func oldBehaviors(for attributes: [UICollectionViewLayoutAttributes]) -> [UIAttachmentBehavior] {

        item.center.x += delta.dx < 0 ? max(delta.dx, delta.dx * resistance.dx) : min(delta.dx, delta.dx * resistance.dx)
    }
}

extension UIDynamicAnimator {
    
    open func addBehavior(_ behavior: UIAttachmentBehavior, _ damping: CGFloat, _ frequency: CGFloat) {
        behavior.damping = damping
        behavior.frequency = frequency
        addBehavior(behavior)
    }
}
