Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let part = CGFloat(totalScoreView.score)/100.0
- let endAngle = part != 0 ? CGFloat(Double.pi * 1.5) * part : CGFloat(Double.pi / -2)
- let circlePath = UIBezierPath(arcCenter: CGPoint(x: infoButtonViewParent.bounds.midX, y: infoButtonViewParent.bounds.midY), radius: totalScoreView.frame.size.width/1.65, startAngle: CGFloat(Double.pi / -2), endAngle: endAngle, clockwise: true)
- let positionAnimation = CAKeyframeAnimation(keyPath: "position");
- positionAnimation.duration = kScoreCircleAnimationDuration
- positionAnimation.path = circlePath.cgPath
- positionAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
- positionAnimation.fillMode = kCAFillModeForwards
- positionAnimation.delegate = self
- positionAnimation.isRemovedOnCompletion = false
- infoButtonView.layer.add(positionAnimation, forKey: nil)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement