gsap scrolltrigger动画垂直

utugiqy6  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(335)

当我的项目在移动时缩放到.5,但无法在foreach中实现滚动触发时,我尝试进行水平滚动

const sections = gsap.utils.toArray(".section");
gsap.to(sections, {
  xPercent:-100*(sections.length-1),
  ease: "none",
  scrollTrigger: {
    trigger: ".container",
    pin: true,
    snap:1/(sections.length-1),
    scrub: true,
    end:`+=${document.querySelector('.container').offsetWidth}`,
  }
});
sections.forEach(section=>{
  gsap.to(section, {
    scale:.5,
    ease: "none",
    scrollTrigger: {
      trigger: section,
      pin: true,
      scrub: true,
      end:`+=${$(section)[0].offsetWidth}`,
      markers:true
    }
  });
});````

Also I cannot put the active class on the current section

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题