Alexey, EPAM
First law of motion
iOS 5
-webkit-overflow-scrolling: touch
we can leave artificial scrollers behind
v = v0 + at
x = x0 + v0t + at22
doMomentum() { const transition = `transform ${time }ms cubic-bezier(0.33, 0.66, 0.66, 1)`; this.setTransition(this.element, transition); this.setTransform(this.element, `translate3d(0, ${newY}px, 0)`); }
doMomentum() { const transition = `transform ${time }ms cubic-bezier(0.33, 0.66, 0.66, 1)`; this.setTransition(this.element, transition); this.setTransform(this.element, `translate3d(0, ${newY}px, 0)`); }
t=v-v0a
Δx=v2-v022a
a =0.005pxms2
doMomentum() { const transition = `transform ${time }ms cubic-bezier(0.33, 0.66, 0.66, 1)`; this.setTransition(this.element, transition); this.setTransform(this.element, `translate3d(0, ${newY}px, 0)`); }
cubic-bezier(.33, .66, .66, 1)
snapToBounds() { const transition = 'transform' + '500ms ease-out'; this.setTransition(this.element, transition); this.setTransform(this.element, `translate3d(0, ${startY}px, 0)`); }
cubic-bezier(0, 0, .58, 1), ease-out
const valueToLowerCubicBezierWith = Math.abs(this.endMomentumVelocity_ / velocity) * .33; const transition = `transform ${time}ms cubic-bezier(.33,${ (.66 - valueToLowerCubicBezierWith) },.66,${ (1 - valueToLowerCubicBezierWith)})` this.setTransition(this.element, transition); this.setTransform(this.element, `translate3d(0, ${this.contentOffsetY }px, 0)`);
v=v02-2a∆x
t=v-v0a
npm install momentum-scroller
Send pull requests to https://github.com/alexeykomov/momentum-scroller