|
@@ -12,13 +12,13 @@ public class PQHeartAnimation: NSObject {
|
|
|
static let angleArr: [CGFloat] = [CGFloat.pi / 4.0, -CGFloat.pi / 4.0, 0.0]
|
|
|
var isRepeat: Bool = false
|
|
|
|
|
|
- static public func showAnimation(isRepeat: Bool = false, point: CGPoint, size: CGFloat = 80.0, baseView: UIView, completeHander: @escaping (_ isFinised: Bool) -> Void) {
|
|
|
+ static public func showAnimation(isRepeat: Bool = false, point: CGPoint, size: CGFloat = 80.0, baseView: UIView,imageName:String? = nil, completeHander: @escaping (_ isFinised: Bool) -> Void) {
|
|
|
if isRepeat, baseView.viewWithTag(cHeartTag) != nil {
|
|
|
return
|
|
|
}
|
|
|
let imgV = UIImageView(frame: CGRect(x: point.x - size / 2.0, y: point.y - size / 2.0, width: size, height: size))
|
|
|
imgV.tag = cHeartTag
|
|
|
- imgV.image = UIImage.moduleImage(named: "ic_heart", moduleName: "BFCommonKit")
|
|
|
+ imgV.image = (imageName != nil && (imageName?.count ?? 0) > 0) ? UIImage.init(named: imageName!) : UIImage.moduleImage(named: "ic_heart", moduleName: "BFCommonKit")
|
|
|
imgV.contentMode = .scaleAspectFill
|
|
|
baseView.addSubview(imgV)
|
|
|
|
|
@@ -36,7 +36,7 @@ public class PQHeartAnimation: NSObject {
|
|
|
animation.values = [1.3, 0.8, 1.0]
|
|
|
imgV.layer.add(animation, forKey: "transform.scale")
|
|
|
|
|
|
- UIView.animate(withDuration: 1, delay: 0.5, options: .layoutSubviews, animations: {
|
|
|
+ UIView.animate(withDuration: 1, delay: 0.5, options: .allowUserInteraction, animations: {
|
|
|
imgV.alpha = 0.0
|
|
|
var newFrame = imgV.frame
|
|
|
newFrame.origin.x -= (isRepeat ? -cDefaultMargin * 2 : cDefaultMargin)
|