|
@@ -9,7 +9,7 @@
|
|
|
import UIKit
|
|
|
|
|
|
public class PQHeartAnimation: NSObject {
|
|
|
- static let angleArr: [CGFloat] = [CGFloat.pi / 4.0, -CGFloat.pi / 4.0, 0.0]
|
|
|
+ static let angleArr: [CGFloat] = [CGFloat.pi / 4.0, -CGFloat.pi / 4.0]
|
|
|
var isRepeat: Bool = false
|
|
|
|
|
|
static public func showAnimation(isRepeat: Bool = false, point: CGPoint, size: CGFloat = 80.0, baseView: UIView,imageName:String? = nil, completeHander: @escaping (_ isFinised: Bool) -> Void) {
|
|
@@ -23,12 +23,12 @@ public class PQHeartAnimation: NSObject {
|
|
|
baseView.addSubview(imgV)
|
|
|
|
|
|
// 偏移角度
|
|
|
- var num = 2
|
|
|
- if !isRepeat {
|
|
|
- num = Int(arc4random_uniform(3))
|
|
|
- }
|
|
|
-// BFLog(message: "num = \(num)")
|
|
|
- imgV.transform = CGAffineTransform(rotationAngle: angleArr[num])
|
|
|
+// var num = 2
|
|
|
+// if !isRepeat {
|
|
|
+// num = Int(arc4random_uniform(2))
|
|
|
+// }
|
|
|
+// debugPrint("num = \(num)")
|
|
|
+// imgV.transform = CGAffineTransform(rotationAngle: angleArr[num])
|
|
|
// 放大动画
|
|
|
let animation = CAKeyframeAnimation(keyPath: "transform.scale")
|
|
|
animation.duration = 0.5
|
|
@@ -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: .allowUserInteraction, animations: {
|
|
|
+ UIView.animate(withDuration: 1, delay: 0, options: .allowUserInteraction, animations: {
|
|
|
imgV.alpha = 0.0
|
|
|
var newFrame = imgV.frame
|
|
|
newFrame.origin.x -= (isRepeat ? -cDefaultMargin * 2 : cDefaultMargin)
|