             return
         }
         
-        let duration: Double = 0.4
-        UIView.animateWithDuration(duration/2, animations: {
-            subview.transform = CGAffineTransformMakeScale(0.6, 0.6)
-            button.backgroundColor = self.rippleColor.colorWithAlphaComponent(0.15)
+        let halfDuration = Double(self.options.animationDuration/2)
+        UIView.animateWithDuration(halfDuration, animations: {
+            subview.transform = CGAffineTransformMakeScale(self.options.animationScaleFactor, self.options.animationScaleFactor)
+            button.backgroundColor = self.options.rippleColor
         }) { complete in
             
             self.onTapCallback?(animatedBarButtonItem: self)
             
-            UIView.animateWithDuration(duration/2, animations: {
+            UIView.animateWithDuration(halfDuration, animations: {
                 button.backgroundColor = UIColor.clearColor()
                 subview.transform = CGAffineTransformIdentity
             }) { complete in

//  Wishlist
//
//  Created by Christian Deckert on 15.11.16.
//  Copyright © 2016 Christian Deckert
//

import Foundation
import UIKit

class CDAnimatedBarButtonItem: UIBarButtonItem {
    
    public var onTapCallback: ((animatedBarButtonItem: CDAnimatedBarButtonItem?) -> Void)?
    public var rippleColor: UIColor = UIColor.blackColor()
    public var font: UIFont?
    public var contentMode: UIViewContentMode?
    
    @IBInspectable public var frame: CGRect? {
        didSet {
            updateUI()
        }
    }
    
    @IBInspectable public var icon: UIImage? {
        didSet {
            updateUI()
        }
    }
    
    @IBInspectable public var text: String? {
        didSet {
            updateUI()
        }
    }
    
    public override var title: String? {
        get {
            return self.text
        }
        
        set {
            self.text = newValue
            updateUI()
        }
    }
    
    public required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        commonInit()
    }
    
    public override init() {

        self.icon = icon
        commonInit()
        
    }
    
    public init(icon: UIImage?, contentMode: UIViewContentMode, callback: (animatedBarButtonItem: CDAnimatedBarButtonItem?) -> Void) {
        super.init()
        onTapCallback = callback
        self.icon = icon
        commonInit()
        self.contentMode = contentMode
    }
    
    public init(options: CDAnimatedBarButtonItemOptions) {
        super.init()
        commonInit()
        self.options = options
    }
    
    public func commonInit() {
