Skip to content

Instantly share code, notes, and snippets.

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 jongwonwoo/28836d5a04e37649e75c to your computer and use it in GitHub Desktop.
Save jongwonwoo/28836d5a04e37649e75c to your computer and use it in GitHub Desktop.
func elasticMotionStateMachine(stateMachine: ElasticMotionStateMachine, didChangeState state: ElasticMotionState, deltaPoint: CGPoint) {
switch state {
case .MayOpen:
let newOriginX = self.view.frame.origin.x + deltaPoint.x
if newOriginX >= 0 && newOriginX < CGFloat(threshold) {
self.view.center = CGPointMake(self.view.center.x + deltaPoint.x, self.view.center.y)
}
// other state
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment