Skip to content

Instantly share code, notes, and snippets.

View nathansearles's full-sized avatar
🧲

Nathan Searles nathansearles

🧲
View GitHub Profile
@nathansearles
nathansearles / scrollTo.js
Created June 8, 2022 16:50 — forked from james2doyle/scrollTo.js
a native scrollTo function in javascript that uses requestAnimationFrame and easing for animation
// easing functions http://goo.gl/5HLl8
Math.easeInOutQuad = function (t, b, c, d) {
t /= d/2;
if (t < 1) {
return c/2*t*t + b
}
t--;
return -c/2 * (t*(t-2) - 1) + b;
};