Jump to content
Search Community

How to fix it? Invalid property – "Missing plugin? gsap.registerPlugin()"

mr.G test
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

3 minutes ago, Cassie said:

Hi there!

 

It would help if we could see your code. But it looks like you possibly haven't registered ScrollTrigger? Before you write any GSAP code, add this line.

gsap.registerPlugin(ScrollTrigger)

Thanks for the quick response
I have this in my code.
I have added a link to Read-only link, you can see the code there. Or should I show the code differently?

Link to comment
Share on other sites

10 minutes ago, Cassie said:

I have no idea how to use webflow sorry!

 

A little code snippet would be useful, thanks.

Okay :) This is the main code for this page
 

<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.3/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.3/ScrollTrigger.min.js"></script>
<script src="https://uploads-ssl.webflow.com/62d7e483a751a962bd1e9d4a/637118b04679d854c04c1f04_ScrollSmoother.min.txt"></script>

<script>
  gsap.registerPlugin(ScrollTrigger, ScrollSmoother);

  $(document).ready(function() {

    gsap.set("#appearBlock", {opacity: 1});
    gsap.set(".navbar", {opacity: 1});
    $('html').animate({scrollTop:0}, 1);
    $('body').animate({scrollTop:0}, 1);


    let smoother = ScrollSmoother.create({
      wrapper: '#smooth-wrapper',
      content: '#smooth-content',
      smooth: 1,
      effects: true
    }); 


    //////////////////////// Navbar
    navbar(".logo_text");
    navbar(".menu_btn");
    ////////////////////////


    //////////////////////// Hero block
    var heroBlock = gsap.timeline()
    heroBlockAppear(".main-heading", .4, 60, "0%", "140%")
    heroBlockAppear(".suptitle_block", .4, 60, "0%", "800%")
    heroBlockAppear(".main_photo", false, 0, "50%", "0%", () => smoother.paused(true), () => smoother.paused(false), 1.4);

    //// Flow gradient title
    b1 = "linear-gradient(90deg, #FDA1A1 0%, #F7CD9D 14.06%, #BAF79D 31.77%, #9CDEFA 56.25%, #9296F2 76.53%, #CF98FA 88.24%, #F797DC 100%)";
    b2 = "linear-gradient(60deg, #8AD0EE 12.03%, #8589F3 33.25%, #E47C7C 59.67%, #A3EF7F 88.9%)";
    gsap.timeline({})
      .fromTo("#gradientText", {width:"100%", height:"100%", backgroundImage: b1}, {ease: "none", duration: 4, backgroundImage: b2, repeat: -1, yoyo: true});
    ////////////////////////


    //////////////////////// Selected works parallax
    ScrollTrigger.matchMedia({
      '(min-width:768px)':function(){
        workParallax(".selected_photo.second", "-10%");
        workParallax(".selected_photo.first", "-20%");
        workParallax(".selected_photo.fourth", "-5%");
        workParallax(".selected_photo.third", "-25%");   
      }
    });
    ////////////////////////


    //////////////////////// Big shot 
    gsap.set("#bigShotFirst", {scale: .3});
    gsap.timeline({scrollTrigger: {
      trigger: ".big_shot_block",
      start: "center center",
      end: "+=1500",
      pin: true,
      scrub: 1
    }})
      .to("#bigShotFirst", {
      scale: 1,
      ease: "power1.inOut",
    });
    //////////////////////// 


    //////////////////////// Shots
    gsap.set(".shots_item.shots_item-second", {x: "-30%"});
    shots(".shots_item.shots_item-first", "-30%");
    shots(".shots_item.shots_item-second", "0%");


    //////////////////////// Footer
    const footer = ".section.black-footer";
    gsap.set(footer, {y: "-50%"});
    gsap.timeline({
      scrollTrigger: {
        trigger: footer,
        start: "top bottom",
        end: "120% 80%",
        scrub: 2
      }})
      .to(footer, {
      y: "0%"
    }); 
    ////////////////////////


    //////////////////////// Functions
    function navbar(target) {
      gsap.from(target, {
        trigger: ".main_section",
        delay: .5,
        scale: .7,
        opacity: 0,
        ease: "power1.inOut",
        duration: 1
      });
    };
    function heroBlockAppear(target, delayValue, opacity, positionX, positionY, whenStart, whenComplete, duration=1) {
      gsap.from(target, {
        delay: delayValue,
        opacity: opacity,
        x: positionX,
        y: positionY,
        rotation: 15,
        ease: "power1.inOut",
        duration: duration,
        onStart: whenStart,
        onComplete: whenComplete
      });
    };
    function workParallax(target, positionY) {
      gsap.to(target, {
        scrollTrigger: {
          trigger: ".selected_block",
          start: "top bottom",
          end: "bottom top",
          scrub: 1
        },
        y: positionY
      });
    };
    function shots(target, positionX) {
      gsap.to(target, {
        scrollTrigger: {
          trigger: ".shots_block",
          start: "top bottom",
          end: "bottom top",
          scrub: 1
        },
        x: positionX
      });
    };
    ////////////////////////

  });
</script>
Link to comment
Share on other sites

  • Solution
gsap.from(target, {
  trigger: ".main_section",
  delay: .5,
  scale: .7,
  opacity: 0,
  ease: "power1.inOut",
  duration: 1
});

Here's the issue!

 

'trigger' isn't valid syntax - you can use scrollTrigger like this, or 'trigger' inside a scrollTrigger object.
 

gsap.to(".box", {
  scrollTrigger: ".box",
  x: 500
});

or

gsap.to(".box", {
  scrollTrigger: {
    trigger: ".box",
    ...
  },
  x: 500
});

 

  • Like 3
Link to comment
Share on other sites

48 minutes ago, Cassie said:
gsap.from(target, {
  trigger: ".main_section",
  delay: .5,
  scale: .7,
  opacity: 0,
  ease: "power1.inOut",
  duration: 1
});

Here's the issue!

 

'trigger' isn't valid syntax - you can use scrollTrigger like this, or 'trigger' inside a scrollTrigger object.
 

gsap.to(".box", {
  scrollTrigger: ".box",
  x: 500
});

or

gsap.to(".box", {
  scrollTrigger: {
    trigger: ".box",
    ...
  },
  x: 500
});

 

Thanks a lot

  • Like 2
Link to comment
Share on other sites

  • 2 months later...

Hi @Norb50,

 

Do you have a minimal demo? Are you having any type of issue with Custom Ease?

 

If you're just using Custom Ease in your setup, then yeah, remember to register it, but nothing else:

import { gsap } from "gsap";
import { CustomEase } from "gsap/CustomEase";

gsap.registerPlugin(CustomEase);

We have an Install Helper guide in the docs that provides the import and register code:

https://greensock.com/docs/v3/Installation

 

Hopefully this helps.

Happy Tweening!

Link to comment
Share on other sites

that's what i have 

import gsap from 'gsap';

 

'part of animation js',
import CustomEase  from "gsap/CustomEase";
gsap.registerPlugin(CustomEase);

const animOnes = (container) => {

 const rightLinks = container.querySelectorAll('.nav-anim')
 const scroll = container.querySelector('.scroll')
 const h1 = container.querySelector('.section-link h1')

 

'part of index.js'

import '/src/css/style.scss'
import smoothscroll from 'smoothscroll-polyfill';
import barba from '@barba/core';
import barbaPrefetch from '@barba/prefetch';
import gsap from 'gsap';
gsap.registerPlugin(CustomEase);
import CustomEase from "gsap/CustomEase";

 

I started this project again still a lot of mess ,it shows me in console ap-core.js:164 GSAP target [object NodeList] not found. 

not found coz it physically doesn't exist is in some html files , so why is it looking for something non existent. In this case 'nav'. it only is in index.htlm 

'about' , 'contact' html's  don't have it . it's like a scrolling nav to sections. 

that's links to it if you like to see it https://6428a954b233897905779d10--blissful-easley-bd2cc4.netlify.app/index.html

One very important thing, I'm not pro.

 

Thanks for answering  

Link to comment
Share on other sites

This definitely looks wrong: 

import gsap from 'gsap';
gsap.registerPlugin(CustomEase);
import CustomEase from "gsap/CustomEase";

You're referencing CustomEase before it's even imported. I assume you meant to order it like this:

import gsap from 'gsap';
import CustomEase from "gsap/CustomEase";
gsap.registerPlugin(CustomEase);

 

We cannot troubleshoot a live web site that has all the code minified, sorry. If you want more help, you'll need to provide a minimal demo, like a CodePen or Stackblitz or CodeSandbox. Please don't include your whole project - just some simple <div> elements that illustrate the issue with as little code as possible. 

 

Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen

 

If you're using something like React/Next/Vue/Nuxt or some other framework, you may find StackBlitz easier to use. We have a series of collections with different templates for you to get started on these different frameworks: React/Next/Vue/Nuxt.

 

Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

Link to comment
Share on other sites

Hello again , I thought I'm done with 'missing plugin' but not , i made all new installation of Gsap and still have console notifications about missing plugin , already registered scroll-plugin coz it told is missing even if I don,t use. and again the same. I made another file for page transition and it seem like this code is messing. I don't see problem coz it works how I want but the notification in console.lines.js  Can you have a look on this?

Screen Shot 2023-04-27 at 10.47.40.png

Link to comment
Share on other sites

  • 2 weeks later...

It's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or CodeSandbox that demonstrates the issue? 

 

Please don't include your whole project. Just some colored <div> elements and the GSAP code is best (avoid frameworks if possible). See if you can recreate the issue with as few dependancies as possible. If not, incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, then at least we have a reduced test case which greatly increases your chances of getting a relevant answer.

 

Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen

 

If you're using something like React/Next/Vue/Nuxt or some other framework, you may find StackBlitz easier to use. We have a series of collections with different templates for you to get started on these different frameworks: React/Next/Vue/Nuxt.

 

Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

Link to comment
Share on other sites

Hi there! I see you're using React -

Proper animation cleanup is very important with frameworks, but especially with React, React 18 runs in strict mode locally by default which causes your useEffect() and useLayoutEffect() to get called TWICE.

 

In GSAP 3.11, we introduced a new gsap.context() feature that helps make animation cleanup a breeze. All you need to do is wrap your code in a context call. All GSAP animations and ScrollTriggers created within the function get collected up in that context so that you can easily revert() ALL of them at once.

 

Here's the structure:

// typically it's best to useLayoutEffect() instead of useEffect() to have React render the initial state properly from the very start.
useLayoutEffect(() => {
  let ctx = gsap.context(() => {
    // all your GSAP animation code here
  });
  return () => ctx.revert(); // <- cleanup!
}, []);

 

One of the React team members chimed in here if you'd like more background.

 

We strongly recommend reading the React information we've put together at https://greensock.com/react

 

 

Happy tweening!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...