Intersection Observer & Efficient Scroll Handling

What is the most efficient way to handle scroll-based animations using Intersection Observer?
const observer = new IntersectionObserver(entries => {
  entries.forEach(entry => {
    if (entry.isIntersecting) {
      entry.target.style.opacity = entry.intersectionRatio;
      entry.target.style.transform = `translateY(${(1 - entry.intersectionRatio) * 50}px)`;
    }
  });
}, {
  threshold: Array.from({ length: 100 }, (_, i) => i / 100)
});
Next Question (6/20)