Created
October 21, 2015 06:39
-
-
Save ahmed-abdurrahman/65c9db0c5188523127e7 to your computer and use it in GitHub Desktop.
Creating the animator and the gravity behaviour to animate our square
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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