fix(keyboard): improve keyboard scroll assist

This commit is contained in:
Adam Bradley
2015-11-13 16:53:25 -06:00
parent a0d0962a6c
commit d5ac78f7b0
8 changed files with 114 additions and 82 deletions

View File

@@ -49,17 +49,16 @@ export class ScrollTo {
}
return new Promise((resolve, reject) => {
let start = Date.now();
let start;
// start scroll loop
self.isPlaying = true;
raf(step);
// decelerating to zero velocity
function easeOutCubic(t) {
return (--t) * t * t + 1;
}
// chill out for a frame first
raf(() => {
start = Date.now();
raf(step);
});
// scroll loop
function step() {
@@ -104,3 +103,8 @@ export class ScrollTo {
}
}
// decelerating to zero velocity
function easeOutCubic(t) {
return (--t) * t * t + 1;
}