]>
cat aescling's git repositories - mastodon.git/blob - app/javascript/themes/glitch/util/scroll.js
1 const easingOutQuint
= (x
, t
, b
, c
, d
) => c
* ((t
= t
/ d
- 1) * t
* t
* t
* t
+ 1) + b
;
3 const scroll
= (node
, key
, target
) => {
4 const startTime
= Date
.now();
5 const offset
= node
[key
];
6 const gap
= target
- offset
;
11 const elapsed
= Date
.now() - startTime
;
12 const percentage
= elapsed
/ duration
;
14 if (percentage
> 1 || interrupt
) {
18 node
[key
] = easingOutQuint(0, elapsed
, offset
, gap
, duration
);
19 requestAnimationFrame(step
);
29 export const scrollRight
= (node
, position
) => scroll(node
, 'scrollLeft', position
);
30 export const scrollTop
= (node
) => scroll(node
, 'scrollTop', 0);
This page took 0.08243 seconds and 5 git commands to generate.