Created
May 12, 2014 23:46
-
-
Save john45traver/ec9852b48dc3a1075ea6 to your computer and use it in GitHub Desktop.
Scrolls scrollview to position
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
var scrollToPosition = function (finalPos, transition) { | |
var lastPos = scroller.getPosition(); | |
var transitionable = new Transitionable(lastPos); | |
var prerender = function () { | |
scroller.setVelocity(0); | |
scroller.setPosition(transitionable.get()); | |
}; | |
Engine.on('prerender', prerender); | |
transitionable.set( finalPos, transition, function(){ Engine.removeListener('prerender',prerender) }); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment