Skip to content

Instantly share code, notes, and snippets.

@Aymenworks
Created January 18, 2019 05:23
Show Gist options
  • Save Aymenworks/f75f5deb3832fb4e2fb2532a8e0ab7a2 to your computer and use it in GitHub Desktop.
Save Aymenworks/f75f5deb3832fb4e2fb2532a8e0ab7a2 to your computer and use it in GitHub Desktop.
func update(progress: CGFloat) {
let shiftedProgress = (progress - AnimationState.start.rawValue) / (AnimationState.full.rawValue - AnimationState.start.rawValue)
let height: CGFloat = foregroundButton.bounds.height * shiftedProgress
let rect = CGRect(x: 0, y: foregroundButton.bounds.height - height, width: foregroundButton.bounds.width, height: height)
let path = UIBezierPath(rect: rect).cgPath
shapeLayer.path = path
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment