paf-raf
v2.0.0
Published
Like window.requestAnimationFrame, but performant AF
Downloads
5
Maintainers
Readme
Usage
$ npm install paf-rafconst things = Array.from(document.querySelectorAll('p,li'));
window.onscroll = () => {
requestAnimationFrame(() => {
const angle = window.scrollY % 360;
things.forEach(thing => {
thing.style.transform = `rotateZ(${angle}deg)`;
});
});
};
const pAF require('paf-raf');
const things = Array.from(document.querySelectorAll('p,li'));
window.onscroll = () => {
pAF(() => {
const angle = window.scrollY % 360;
things.forEach(thing => {
pAF(() => {
thing.style.transform = `rotateZ(${angle}deg)`;
});
});
});
};
