Jump to content
GreenSock

BarheimCoder

"Invalid property" "frame" "set to" 49 "Missing plugin? gsap.registerPlugin()"

Go to solution Solved by GreenSock,

Recommended Posts

Trying to improve some code for lottie loading and I'm running into a small warning.

 

Frame Declaration

This is how I first found about loading lotties and declaring the frame to be used with scrollTrigger.

 let lottieFrame1 = { frame: 0 },  lottieAnim1 = { ... };

 

I've now moved the frame to be part of the lottie loading, requiring one less variable declaration (also helps when using multiple lotties on a page).

"Invalid property" "frame" "set to" 49 "Missing plugin? gsap.registerPlugin()"

 

This only happens once scrollTrigger takes over the animation, and my guess is that happens because the lottie syntax doesn't have "frame" property so it assumes it's an unregistered plugin.

 

Is there a fix or it's just a matter of disabling the warning? Thanks in advance

See the Pen dydEMMb?editors=0011 by barheimcoder (@barheimcoder) on CodePen

Link to comment
Share on other sites

  • Solution

No, don't ignore that - it's telling you something important. There's an error in your code. You're assuming that the object that gets RETURNED by lottie.loadAnimation() will contain that "frame" property but that isn't true. You're passing it in the config object, but that's totally different. That's not what gets returned. 

 

You could just add this instead: 

lotties.forEach(l => l.frame = 0);

 

Link to comment
Share on other sites

Thank you! That makes sense, I've applied your solution and it fixed the warning.

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.
×