A value between 0-1
// Scroll halfway into the given element.
const scrollY = mathf.getScrollYAtPercent(element, 0, 0, 0.5);
window.scrollTo(0, scrollY);
// Scroll 0.2 percent into the given element.
const scrollY = mathf.getScrollYAtPercent(element, 0, 0, 0.2);
window.scrollTo(0, scrollY);
Inverse of getElementScrolledPercent. Given an element on the page, finds the scrollY value in order to scroll into that element by the provided percent.