<commit_before>//
//  WCLShineClickLayer.swift
//  WCLShineButton
//
// **************************************************
// *                                  _____         *
// *         __  _  __     ___        \   /         *
// *         \ \/ \/ /    / __\       /  /          *
// *          \  _  /    | (__       /  /           *
// *           \/ \/      \___/     /  /__          *
// *                               /_____/          *
// *                                                *
// **************************************************
//  Github  :https://github.com/imwcl
//  HomePage:https://imwcl.com
//  CSDN    :http://blog.csdn.net/wang631106979
//
//  Created by 王崇磊 on 16/9/14.
//  Copyright © 2016年 王崇磊. All rights reserved.
//
// @class WCLShineClickLayer
// @abstract 点击效果的layer
// @discussion 点击效果的layer
//

import UIKit

class WCLShineClickLayer: CALayer {
    
    var color: UIColor = UIColor.lightGray
    
    var fillColor: UIColor = UIColor(rgb: (255, 102, 102))
    
    var image: WCLShineImage = .heart {
        didSet {
            maskLayer.contents = image.getImage()
        }
    }
    
    var animDuration: Double = 0.5
    
    var clicked: Bool = false {
        didSet {
            if clicked {
                backgroundColor = fillColor.cgColor
            }else {
                backgroundColor = color.cgColor
            }
        }
    }
    
    let maskLayer = CALayer()
    
    //MARK: Public Methods
    public func startAnim() {
        let anim = CAKeyframeAnimation(keyPath: "transform.scale")
        anim.duration  = animDuration
        anim.values = [0.4, 1, 0.9, 1]
        anim.calculationMode = kCAAnimationCubic
        maskLayer.add(anim, forKey: "scale")
    }
    <commit_msg>Button image can now be changed after initially being set<commit_after>//
//  WCLShineClickLayer.swift
//  WCLShineButton
//
// **************************************************
// *                                  _____         *
// *         __  _  __     ___        \   /         *
// *         \ \/ \/ /    / __\       /  /          *
// *          \  _  /    | (__       /  /           *
// *           \/ \/      \___/     /  /__          *
// *                               /_____/          *
// *                                                *
// **************************************************
//  Github  :https://github.com/imwcl
//  HomePage:https://imwcl.com
//  CSDN    :http://blog.csdn.net/wang631106979
//
//  Created by 王崇磊 on 16/9/14.
//  Copyright © 2016年 王崇磊. All rights reserved.
//
// @class WCLShineClickLayer
// @abstract 点击效果的layer
// @discussion 点击效果的layer
//

import UIKit

class WCLShineClickLayer: CALayer {
    
    var color: UIColor = UIColor.lightGray
    
    var fillColor: UIColor = UIColor(rgb: (255, 102, 102))
    
    var image: WCLShineImage = .heart {
        didSet {
            maskLayer.contents = image.getImage()?.cgImage
        }
    }
    
    var animDuration: Double = 0.5
    
    var clicked: Bool = false {
        didSet {
            if clicked {
                backgroundColor = fillColor.cgColor
            }else {
                backgroundColor = color.cgColor
            }
        }
    }
    
    let maskLayer = CALayer()
    
    //MARK: Public Methods
    public func startAnim() {
        let anim = CAKeyframeAnimation(keyPath: "transform.scale")
        anim.duration  = animDuration
        anim.values = [0.4, 1, 0.9, 1]
        anim.calculationMode = kCAAnimationCubic
        maskLayer.add(anim, forKey: "scale")
    }
    
{'fraction_non_alphanumeric': 0.16942496493688639, 'fraction_numerical': 0.019635343618513323, 'mean_word_length': 1.2526847757422614, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4654833', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1110, 'n_words': 189}