Skip to content

Commit

Permalink
Merge pull request #150 from LaurentiuUngur/fixes
Browse files Browse the repository at this point in the history
Fix some castings of `.pi`
  • Loading branch information
PGLongo authored Mar 29, 2017
2 parents 8fef55f + 64749af commit c97be67
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
54 changes: 27 additions & 27 deletions PKHUD/PKHUDAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,34 @@ public final class PKHUDAnimation {
public static let discreteRotation: CAAnimation = {
let animation = CAKeyframeAnimation(keyPath: "transform.rotation.z")
animation.values = [
NSNumber(value: 0.0 as Float),
NSNumber(value: 1.0 * Float(Double.pi) / 6.0 as Float),
NSNumber(value: 2.0 * Float(Double.pi) / 6.0 as Float),
NSNumber(value: 3.0 * Float(Double.pi) / 6.0 as Float),
NSNumber(value: 4.0 * Float(Double.pi) / 6.0 as Float),
NSNumber(value: 5.0 * Float(Double.pi) / 6.0 as Float),
NSNumber(value: 6.0 * Float(Double.pi) / 6.0 as Float),
NSNumber(value: 7.0 * Float(Double.pi) / 6.0 as Float),
NSNumber(value: 8.0 * Float(Double.pi) / 6.0 as Float),
NSNumber(value: 9.0 * Float(Double.pi) / 6.0 as Float),
NSNumber(value: 10.0 * Float(Double.pi) / 6.0 as Float),
NSNumber(value: 11.0 * Float(Double.pi) / 6.0 as Float),
NSNumber(value: 2.0 * Float(Double.pi) as Float)
NSNumber(value: 0.0),
NSNumber(value: 1.0 * .pi / 6.0),
NSNumber(value: 2.0 * .pi / 6.0),
NSNumber(value: 3.0 * .pi / 6.0),
NSNumber(value: 4.0 * .pi / 6.0),
NSNumber(value: 5.0 * .pi / 6.0),
NSNumber(value: 6.0 * .pi / 6.0),
NSNumber(value: 7.0 * .pi / 6.0),
NSNumber(value: 8.0 * .pi / 6.0),
NSNumber(value: 9.0 * .pi / 6.0),
NSNumber(value: 10.0 * .pi / 6.0),
NSNumber(value: 11.0 * .pi / 6.0),
NSNumber(value: 2.0 * .pi)
]
animation.keyTimes = [
NSNumber(value: 0.0 as Float),
NSNumber(value: 1.0 / 12.0 as Float),
NSNumber(value: 2.0 / 12.0 as Float),
NSNumber(value: 3.0 / 12.0 as Float),
NSNumber(value: 4.0 / 12.0 as Float),
NSNumber(value: 5.0 / 12.0 as Float),
NSNumber(value: 0.5 as Float),
NSNumber(value: 7.0 / 12.0 as Float),
NSNumber(value: 8.0 / 12.0 as Float),
NSNumber(value: 9.0 / 12.0 as Float),
NSNumber(value: 10.0 / 12.0 as Float),
NSNumber(value: 11.0 / 12.0 as Float),
NSNumber(value: 1.0 as Float)
NSNumber(value: 0.0),
NSNumber(value: 1.0 / 12.0),
NSNumber(value: 2.0 / 12.0),
NSNumber(value: 3.0 / 12.0),
NSNumber(value: 4.0 / 12.0),
NSNumber(value: 5.0 / 12.0),
NSNumber(value: 0.5),
NSNumber(value: 7.0 / 12.0),
NSNumber(value: 8.0 / 12.0),
NSNumber(value: 9.0 / 12.0),
NSNumber(value: 10.0 / 12.0),
NSNumber(value: 11.0 / 12.0),
NSNumber(value: 1.0)
]
animation.duration = 1.2
animation.calculationMode = "discrete"
Expand All @@ -53,7 +53,7 @@ public final class PKHUDAnimation {
static let continuousRotation: CAAnimation = {
let animation = CABasicAnimation(keyPath: "transform.rotation.z")
animation.fromValue = 0
animation.toValue = 2.0 * Double.pi
animation.toValue = 2.0 * .pi
animation.duration = 1.2
animation.repeatCount = Float(INT_MAX)
return animation
Expand Down
6 changes: 3 additions & 3 deletions PKHUD/PKHUDErrorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ open class PKHUDErrorView: PKHUDSquareBaseView, PKHUDAnimating {
}

animation.fromValue = 0.0
animation.toValue = angle * CGFloat(Double.pi / 180.0)
animation.toValue = angle * CGFloat(.pi / 180.0)
animation.duration = 1.0
animation.timingFunction = CAMediaTimingFunction(name:kCAMediaTimingFunctionEaseInEaseOut)
return animation
Expand All @@ -72,8 +72,8 @@ open class PKHUDErrorView: PKHUDSquareBaseView, PKHUDAnimating {
let dashOneAnimation = rotationAnimation(-45.0)
let dashTwoAnimation = rotationAnimation(45.0)

dashOneLayer.transform = CATransform3DMakeRotation(-45 * CGFloat(Double.pi/180), 0.0, 0.0, 1.0)
dashTwoLayer.transform = CATransform3DMakeRotation(45 * CGFloat(Double.pi/180), 0.0, 0.0, 1.0)
dashOneLayer.transform = CATransform3DMakeRotation(-45 * CGFloat(.pi / 180.0), 0.0, 0.0, 1.0)
dashTwoLayer.transform = CATransform3DMakeRotation(45 * CGFloat(.pi / 180.0), 0.0, 0.0, 1.0)

dashOneLayer.add(dashOneAnimation, forKey: "dashOneAnimation")
dashTwoLayer.add(dashTwoAnimation, forKey: "dashTwoAnimation")
Expand Down

2 comments on commit c97be67

@nkanellopoulos
Copy link

@nkanellopoulos nkanellopoulos commented on c97be67 Mar 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would need to bump the pod spec version to 4.2.1, so that pod users receive this code, right?

@PGLongo
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, or you can specify to use the master version. Sorry, but I don't want to release a new pod version for a warning or for a minor improvement like this

Please sign in to comment.