Skip to content

Instantly share code, notes, and snippets.

@andresbrun
Last active December 21, 2016 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andresbrun/5f72554c07e3ee392b172f15737c05cc to your computer and use it in GitHub Desktop.
Save andresbrun/5f72554c07e3ee392b172f15737c05cc to your computer and use it in GitHub Desktop.
Shows how to apply gravity behaviour
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