Webflow sync, pageviews & more.
NEW

How can I implement GreenSock's GSAP ScrollTrigger and TextPlugin together in Webflow?

TL;DR
  • Add GSAP, ScrollTrigger, and TextPlugin via CDN in the Webflow page's "Before " section.
  • Register the plugins in custom script and define your animation targeting a class like .text-animate.
  • Assign this class to desired text elements and ensure they have placeholder text.
  • Publish your site to test animations, as custom scripts only run on the live site.

To use GSAP's ScrollTrigger and TextPlugin together in Webflow, you'll need to load the External JS files and then initialize your animation using custom code. Here's how to implement both plugins properly.

1. Add GSAP and Plugins via CDN

  • Go to your Webflow project.

  • Click the "Pages" icon, choose the page you're working on.

  • Scroll to the bottom, open the Page Settings, and paste the following inside the Before tag section:

  • GSAP core: https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js

  • ScrollTrigger plugin: https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js

  • TextPlugin: https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/TextPlugin.min.js

    Example (combined):

    ```html

    ```

2. Register the Plugins in Your Custom Code

  • Under the same Before tag section, after the CDN links, add your custom script:

    ```html

    ```

3. Assign Webflow Elements a Specific Class

  • In Webflow Designer, select the element you want to animate.
  • Give it the class name text-animate (or match whatever selector you used in your script).
  • Ensure the element contains some placeholder text, like “Loading...” — GSAP’s TextPlugin will replace it.

4. Ensure Smooth ScrollTrigger Functionality

  • Make sure the element has enough scroll space to trigger the effect based on your start and end positions (e.g., start: "top 80%").
  • If necessary, add paddings or spacers above the element to trigger at the right scroll point.

5. Publish Your Site

  • Scroll animations and plugins will only work when you publish the site (custom scripts won’t run in preview mode).
  • Click Publish to selected domain, then test initial load and scroll behavior live.

Summary

To use GSAP’s ScrollTrigger and TextPlugin in Webflow, include the necessary CDNs and custom code in your page settings, register both plugins using gsap.registerPlugin(...), then apply animations targeting elements with matching class names. Always test on the published version of your site.

Rate this answer

Other Webflow Questions