//
//  Button.swift
//  Kalker
//
//  Created by Łukasz Żukowski on 25.09.2017.
//  Copyright © 2017 Starlab. All rights reserved.
//

import Foundation
import UIKit

func clickAnimation(button: UIButton) {
    UIView.animate(withDuration: 0.25, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: [], animations: {
        button.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
    }, completion: { finished in
        UIView.animate(withDuration: 0.25, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: .curveEaseInOut, animations: {
            button.transform = CGAffineTransform(scaleX: 1, y: 1)
        }, completion: nil
        )
    }
    )
}

func clickAnimationImage(image: UIImageView) {
    UIView.animate(withDuration: 0.25, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: [], animations: {
        image.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
    }, completion: { finished in
        UIView.animate(withDuration: 0.25, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 5, options: .curveEaseInOut, animations: {
            image.transform = CGAffineTransform(scaleX: 1, y: 1)
        }, completion: nil
        )
    }
    )
}
