🥹[GSAP] một mẫu sử dụng ScrollTrigger, Observer, ScrollSmoother crack (ok)

https://github.com/iboxz/gsap-plugins-cracked

ScrollSmoother:
<script src="https://cdn.glitch.global/8352fc0e-bebe-4680-ae0b-269da8b54259/ScrollSmoother.min.js"></script>
ScrambleTextPlugin3:
<script src="https://cdn.glitch.global/8352fc0e-bebe-4680-ae0b-269da8b54259/ScrambleTextPlugin3.min.js"></script>
SplitText:
<script src="https://cdn.glitch.global/8352fc0e-bebe-4680-ae0b-269da8b54259/SplitText.min.js
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="lionel.css">
  <title>Document</title>
</head>
<body>
  <div id="smooth-wrapper">
    <div id="smooth-content">
      <div class="description">
        <div>
          <h1>Horizontal "<code>containerAnimation</code>"</h1>
          <p>Scroll this page vertically and you'll see a horizontal fake-scrolling section where a container is
            animated on the x-axis using a ScrollTrigger animation. With <code>containerAnimation</code> you can trigger
            animations when certain elements <i>inside</i> that container enter the viewport horizontally! It's like a
            ScrollTrigger inside of a ScrollTrigger. 🤯
          </p>
        </div>
      </div>
      <div class="container">
        <section class="panel blue">
          <p>Scroll down to animate horizontally Blue</p>
          <div class="box-1 box">box-1</div>
        </section>
        <section class="panel orange">
          <p>Scroll down to animate horizontally Red</p>
          <div class="box-2 box">box-2</div>
        </section>
        <section class="panel red">
          <p>Scroll down to animate horizontally Blue</p>
          <div class="box-3 box">box-3</div>
        </section>
        <section class="panel purple">
          <p>Scroll down to animate horizontally Red</p>
          <div class="box-4 box">box-4</div>
        </section>
        <section class="panel green">
          <p>Scroll down to animate horizontally Blue</p>
          <div class="box-5 box">box-5</div>
        </section>
      </div>
      <div class="final">
        <div>
          <h1>Wasn't that fun?</h1>
          <p>Here are a few caveats to keep in mind:</p>
          <ul>
            <li>The fake-scrolling animation (just the part that's moving the container horizontally) must have no
              easing (<code>ease: "none"</code>).</li>
            <li>Pinning and snapping won't work on ScrollTriggers with a <code>containerAnimation</code>.</li>
            <li>The mapping of scroll position trigger points are based on the trigger element itself not being animated
              horizontally (inside the container). If you need to animate the trigger, you can either wrap it in a
              &lt;div&gt; and use that as the trigger instead or just factor the trigger's movement into your end
              position. For example, if you animate it left 100px, make the <code>end</code> 100px further to the left.
            </li>
            <li>Requires ScrollTrigger 3.8.0 or later</li>
          </ul>
        </div>
      </div>
    </div>
  </div>
  <script src="https://assets.codepen.io/16327/gsap-latest-beta.min.js?r=v3.11.3"></script>
  <script src="https://assets.codepen.io/16327/ScrollTrigger.min.js"></script>
  <script src="https://unpkg.com/gsap/dist/Observer.min.js"></script>
  <script src="ScrollSmoother.min.js"></script>
  <script src="lionel.js"></script>
</body>
</html>
gsap.registerPlugin(ScrollTrigger, Observer, ScrollSmoother);
ScrollSmoother.create({
  smooth: 1, // how long (in seconds) it takes to "catch up" to the native scroll position
  effects: true, // looks for data-speed and data-lag attributes on elements
  smoothTouch: 0.1 // much shorter smoothing time on touch devices (default is NO smoothing on touch devices)
});
let sections = gsap.utils.toArray(".panel");
let dragRatio = 1;
let scrollTo;
let scrollTween = gsap.to(sections, {
  xPercent: -100 * (sections.length - 1),
  ease: "none",
  scrollTrigger: {
    trigger: ".container",
    pin: true,
    markers: false,
    scrub: 0.1,
    onRefresh: self => {
      dragRatio =
        (self.end - self.start) / (
          (sections.length - 1) * sections[0].offsetWidth);
    },
    end: "+=3000"
  }
});
Observer.create({
  target: ".container",
  type: "wheel,touch,pointer",
  onPress: self => {
    self.startScroll = scrollTween.scrollTrigger.scroll();
    scrollTo = gsap.quickTo(scrollTween.scrollTrigger, "scroll", {
      duration: 0.5,
      ease: "power3"
    });
  },
  onDrag: self => {
    scrollTo(self.startScroll + (self.startX - self.x) * dragRatio);
  }
});
// gsap.set(".box-1, .box-2", { y: 100 });
ScrollTrigger.defaults({ markers: false });
// red section
gsap.to(".box-1", {
  y: -130,
  duration: 2,
  ease: "none",
  scrollTrigger: {
    trigger: ".box-1",
    containerAnimation: scrollTween,
    start: "left center",
    toggleActions: "play none none reset",
  }
});
// gray section
gsap.to(".box-2", {
  y: -120,
  backgroundColor: "#1e90ff",
  ease: "none",
  scrollTrigger: {
    trigger: ".box-2",
    containerAnimation: scrollTween,
    start: "center 80%",
    end: "center 20%",
    scrub: true
  }
});
// purple section
ScrollTrigger.create({
  trigger: ".box-3",
  containerAnimation: scrollTween,
  toggleClass: "active",
  start: "center 60%"
});
ScrollTrigger.create({
  trigger: ".box-4",
  containerAnimation: scrollTween,
  toggleClass: "active",
  start: "center 60%"
});
// green section
ScrollTrigger.create({
  trigger: ".green",
  containerAnimation: scrollTween,
  start: "center 65%",
  end: "center 51%",
  onEnter: () => {
    console.log("enter");
  },
  onLeave: () => {
    console.log("leave")
  },
  onEnterBack: () => {
    console.log("enterBack")
  },
  onLeaveBack: () => {
    console.log("leaveBack")
  },
  onToggle: self => {
    console.log("active", self.isActive)
  },
});

Last updated