Skip to content

Instantly share code, notes, and snippets.

@nthState
Created April 22, 2016 09:18
Show Gist options
  • Save nthState/dd63694681f36895d1050b5395187e6d to your computer and use it in GitHub Desktop.
Save nthState/dd63694681f36895d1050b5395187e6d to your computer and use it in GitHub Desktop.
Quadratic UIView animation
self.topConstraint.constant = 0.0
UIView.animateWithDuration(2, delay: 1, options: UIViewAnimationOptions.CurveEaseInOut, animations: {
CATransaction.begin()
CATransaction.setValue(2, forKey: "kCATransactionAnimationDuration")
let f = CAMediaTimingFunction(controlPoints: 0.43, 0, 0.57, 1) //quad ease in out
CATransaction.setAnimationTimingFunction(f)
self.view.layoutIfNeeded()
CATransaction.commit()
}, completion: { (complete:Bool) in
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment