Skip to content

Instantly share code, notes, and snippets.

@tbatsuur
Created December 11, 2018 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbatsuur/69f0b2215485b0dcf228f69bd8f56a19 to your computer and use it in GitHub Desktop.
Save tbatsuur/69f0b2215485b0dcf228f69bd8f56a19 to your computer and use it in GitHub Desktop.
func moveYellow() {
self.yellowView.layer.cornerRadius = self.yellowView.frame.width/2
self.yellowView.clipsToBounds = true
let circlePath = UIBezierPath(arcCenter: CGPoint(x: DeviceScreen.main.centreX ,y: DeviceScreen.main.centreY), radius: 100.0, startAngle: CGFloat(0), endAngle:CGFloat(Double.pi * 2), clockwise: true)
let animation = CAKeyframeAnimation(keyPath: #keyPath(CALayer.position))
animation.duration = 5.0
animation.repeatCount = MAXFLOAT
animation.path = circlePath.cgPath
self.yellowView.layer.add(animation, forKey: nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment