Skip to content

Instantly share code, notes, and snippets.

@ahmed-abdurrahman
Created October 21, 2015 06:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Creating the animator and the gravity behaviour to animate our square
lazy var animator: UIDynamicAnimator = {
return UIDynamicAnimator(referenceView: self.animationView)
}()
lazy var gravity:UIGravityBehavior = {
let lazyGravity = UIGravityBehavior()
return lazyGravity
}()
func animateSquare(){
// 1. Add behaviors to the animator
animator.addBehavior(gravity)
// 2. Add items to the behavior
gravity.addItem(squareView)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment