Last active
December 21, 2016 10:54
-
-
Save andresbrun/5f72554c07e3ee392b172f15737c05cc to your computer and use it in GitHub Desktop.
Shows how to apply gravity behaviour
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
let gravityBehaviour = UIGravityBehavior(items: [targetView]) | |
animator.addBehavior(gravityBehaviour) | |
// It can be defined with | |
gravityBehaviour.magnitude = 1.0 // Gravity on earth | |
gravityBehaviour.angle = .pi / 2.0 // downward direction | |
// Or | |
gravityBehaviour.gravityDirection = CGVector(dx: 0.0, dy: 1.0) // Gravity on earth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment