anyone replicate the swipe and snap of iOS's home screen?

jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
edited April 2013 in Working with GS (Mac)
I have a need to replicate the swipe and snap of iOS apps menu. When you have multiple pages of apps in iOS, if you scroll slowly, the apps move with your finger, but if you scroll fast, it flips to the next page. the current swipe menu selection I have from a few years ago just slows down and snaps to the center of where it lands, not the very next one.

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    edited April 2013
    If you can determine which "page number" you want it to land on, you can do it with an interpolate. The example below uses an attribute called 'page#' to snap to the right place.

    Interpolate Attribute: scene.Camera.Origin.X
    To: min( scene.Size.Width-game.Display Size.Width,max(0,self.page#*game.Display Size.Width))
    Speed: .33
    Function: Ease in/out
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Here is an example that might help. The fast swipe stuff is a bit messed up (perhaps someone can simplify it) but slowly dragging to a new page and snapping to the center spot on the page works pretty well.
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Nice one, @RThurman!
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    awesome, I'll give that a whirl today.
Sign In or Register to comment.