@@ -14,9 +14,9 @@ import UIKit
1414// MARK: - Ball Vertical Bounce
1515extension ProgressHUD {
1616
17- func animationBallVerticalBounce( _ view: UIView , _ color : UIColor ) {
17+ func animationBallVerticalBounce( _ view: UIView ) {
1818 let line = CAShapeLayer ( )
19- line. strokeColor = color . cgColor
19+ line. strokeColor = colorAnimation . cgColor
2020 line. lineWidth = view. frame. height / 15
2121 line. lineCap = . round
2222 line. fillColor = UIColor . clear. cgColor
@@ -26,14 +26,14 @@ extension ProgressHUD {
2626 let animationDownCurve = CAKeyframeAnimation ( keyPath: " path " )
2727 animationDownCurve. timingFunction = CAMediaTimingFunction ( name: . easeOut)
2828 animationDownCurve. duration = 2.1 * speed
29- animationDownCurve. values = [ initialCurvePath ( in : view) . cgPath, downCurvePath ( in : view) . cgPath]
29+ animationDownCurve. values = [ initialCurvePath ( view) . cgPath, downCurvePath ( view) . cgPath]
3030 animationDownCurve. autoreverses = true
3131 animationDownCurve. beginTime = 2.9 * speed
3232
3333 let animationTopCurve = CAKeyframeAnimation ( keyPath: " path " )
3434 animationTopCurve. timingFunction = CAMediaTimingFunction ( name: . easeOut)
3535 animationTopCurve. duration = 0.4 * speed
36- animationTopCurve. values = [ initialCurvePath ( in : view) . cgPath, topCurvePath ( in : view) . cgPath]
36+ animationTopCurve. values = [ initialCurvePath ( view) . cgPath, topCurvePath ( view) . cgPath]
3737 animationTopCurve. autoreverses = true
3838 animationTopCurve. beginTime = 7.1 * speed
3939
@@ -43,12 +43,12 @@ extension ProgressHUD {
4343 animationGroup. repeatCount = . infinity
4444
4545 line. add ( animationGroup, forKey: " pathAnimation " )
46- line. path = initialCurvePath ( in : view) . cgPath
46+ line. path = initialCurvePath ( view) . cgPath
4747
48- createBallAnimation ( in : view, with : color , speed : speed)
48+ createBallAnimation ( view, speed)
4949 }
5050
51- private func initialCurvePath( in view: UIView ) -> UIBezierPath {
51+ private func initialCurvePath( _ view: UIView ) -> UIBezierPath {
5252 let width = view. frame. size. width
5353 let height = view. frame. size. height + view. frame. size. height / 3
5454 let path = UIBezierPath ( )
@@ -57,7 +57,7 @@ extension ProgressHUD {
5757 return path
5858 }
5959
60- private func downCurvePath( in view: UIView ) -> UIBezierPath {
60+ private func downCurvePath( _ view: UIView ) -> UIBezierPath {
6161 let width = view. frame. size. width
6262 let height = view. frame. size. height + view. frame. size. height / 3
6363 let path = UIBezierPath ( )
@@ -66,7 +66,7 @@ extension ProgressHUD {
6666 return path
6767 }
6868
69- private func topCurvePath( in view: UIView ) -> UIBezierPath {
69+ private func topCurvePath( _ view: UIView ) -> UIBezierPath {
7070 let width = view. frame. size. width
7171 let height = view. frame. size. height + view. frame. size. height / 3
7272 let path = UIBezierPath ( )
@@ -75,13 +75,13 @@ extension ProgressHUD {
7575 return path
7676 }
7777
78- private func createBallAnimation( in view: UIView , with color : UIColor , speed: Double ) {
78+ private func createBallAnimation( _ view: UIView , _ speed: Double ) {
7979 let width = view. frame. size. width
8080 let height = view. frame. size. height
8181 let size = width / 4
8282 let yPosition = height - height / 3
8383
84- let circle = drawCircleWith ( CGSize ( width: size, height: size) , color )
84+ let circle = drawCircleWith ( CGSize ( width: size, height: size) )
8585 circle. frame = CGRect ( x: width / 2 - size / 2 , y: height / 20 , width: size, height: size)
8686
8787 let animation = CABasicAnimation ( keyPath: " transform.translation.y " )
@@ -96,15 +96,15 @@ extension ProgressHUD {
9696 view. layer. addSublayer ( circle)
9797 }
9898
99- private func drawCircleWith( _ size: CGSize , _ color : UIColor ) -> CALayer {
99+ private func drawCircleWith( _ size: CGSize ) -> CALayer {
100100 let path = UIBezierPath ( )
101101 let radius = size. width / 4
102102 let center = CGPoint ( x: size. width / 2 , y: size. height / 2 )
103103 path. addArc ( withCenter: center, radius: radius, startAngle: 0 , endAngle: 2 * CGFloat. pi, clockwise: true )
104104
105105 let layer = CAShapeLayer ( )
106106 layer. fillColor = nil
107- layer. strokeColor = color . cgColor
107+ layer. strokeColor = colorAnimation . cgColor
108108 layer. lineWidth = size. width / 2
109109 layer. backgroundColor = nil
110110 layer. path = path. cgPath
0 commit comments