Skip to content

Instantly share code, notes, and snippets.

@koenbok
Created October 20, 2013 20:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koenbok/7074987 to your computer and use it in GitHub Desktop.
Save koenbok/7074987 to your computer and use it in GitHub Desktop.
endScrollMomentum = function(event) {
var animation, constant1, constant2, totalVelocity, touchEvent, velocity;
touchEvent = Events.sanitize(event);
constant1 = 1000;
constant2 = 0;
velocity = dragger.calculateVelocity();
totalVelocity = utils.pointAbs(utils.pointTotal(velocity));
scrollView.contentView.animate({
properties: {
x: scrollView.contentView.x + (velocity.x * constant1),
y: scrollView.contentView.y + (velocity.y * constant1)
},
curve: "spring(100,80," + (totalVelocity * constant2) + ")"
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment