Skip to content

Instantly share code, notes, and snippets.

@hemant3370
Created March 28, 2017 08:48
Show Gist options
  • Save hemant3370/5e73de911d5b7f51a5618e26a32f9912 to your computer and use it in GitHub Desktop.
Save hemant3370/5e73de911d5b7f51a5618e26a32f9912 to your computer and use it in GitHub Desktop.
let circlePath2 = UIBezierPath(arcCenter: CGPoint(x: self.swapBtn.frame.midX, y: self.swapBtn.frame.midY), radius: -self.frame.width/3, startAngle: CGFloat(M_PI * 2.0), endAngle: CGFloat(M_PI) , clockwise: false)
let animation2 = CAKeyframeAnimation(keyPath: "position");
animation2.duration = 0.7
animation2.repeatCount = MAXFLOAT
animation2.path = circlePath2.cgPath
animation2.repeatCount = 0
animation2.fillMode = kCAFillModeForwards
animation2.isRemovedOnCompletion = false
let circlePath = UIBezierPath(arcCenter: CGPoint(x: self.swapBtn.frame.midX, y: self.swapBtn.frame.midY), radius: -self.frame.width/3, startAngle: CGFloat(M_PI) , endAngle: CGFloat(M_PI * 2.0) , clockwise: true)
let animation = CAKeyframeAnimation(keyPath: "position");
animation.duration = 0.7
animation.repeatCount = MAXFLOAT
animation.path = circlePath.cgPath
animation.repeatCount = 0
animation.fillMode = kCAFillModeForwards
animation.isRemovedOnCompletion = false
to.layer.add(animation2, forKey: nil)
from.layer.add(animation, forKey: nil)
let buf = from
from = to
to = buf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment