Skip to content

Instantly share code, notes, and snippets.

@alsedi
Last active May 25, 2018 08:29
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 alsedi/235b970187449c817a24264630512404 to your computer and use it in GitHub Desktop.
Save alsedi/235b970187449c817a24264630512404 to your computer and use it in GitHub Desktop.
func animate(duration:TimeInterval, delay:TimeInterval) {
let animation = CAKeyframeAnimation(keyPath: "path")
animation.timingFunction = CAMediaTimingFunction(controlPoints: 0.66, 0.86, 0.11, 0.95)
animation.keyTimes = [0.0, 0.2, 0.6, 1.0]
animation.values = [circlePath, circlePath, rectangleShape, rectangleShape]
animation.beginTime = delay
animation.duration = duration
animation.fillMode = kCAFillModeForwards
animation.isRemovedOnCompletion = false
animation.repeatCount = Float.infinity
animation.autoreverses = true
add(animation, forKey: "path")
}
@kamaldeepsinghbhatia
Copy link

kamaldeepsinghbhatia commented May 25, 2018

Hey,
Can you please check if line: 5 is correct? ( animation.values = [circlePath, circlePath, rectangleShape, rectangleShape] )
I think it should be rectanglePath.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment