Created
March 28, 2014 00:09
-
-
Save jtremback/9822044 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function _handleTouch() { | |
var self = this; | |
self.pageViewPos = new Transitionable(0); | |
self.sync = new GenericSync(function() { | |
return self.pageViewPos.get(0); | |
}, {direction: GenericSync.DIRECTION_X}); | |
self.pageView.pipe(self.sync); | |
self.sync.on('update', function(data) { | |
if(self.pageViewPos.get() === 0 && data.p > 0) { | |
self.menuView.animateStrips(); | |
} | |
self.pageViewPos.set(Math.max(0, data.p)); | |
}); | |
self.sync.on('end', (function(data) { | |
var velocity = data.v; | |
var position = self.pageViewPos.get(); | |
if(self.pageViewPos.get() > self.options.posThreshold) { | |
if(velocity < -self.options.velThreshold) { | |
self.slideLeft(); | |
} else { | |
self.slideRight(); | |
} | |
} else { | |
if(velocity > self.options.velThreshold) { | |
self.slideRight(); | |
} else { | |
self.slideLeft(); | |
} | |
} | |
})); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment