Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
salyone

Gsap 3 and ScrollMagic with npm

Recommended Posts

Hello ^_^
When i import scrollMagic files via npm , it gives me error and says: "Uncaught ReferenceError: TweenMax is not defined" , in Gsap2 I was importing TweenMax by hand and it helped,  but in Gsap3 i don't know how to do it, can you help me? 

Thank you

Share this post


Link to post
Share on other sites

ScrollMagic isn't a gsap product. You should open an issue with them. 

https://github.com/janpaepke/ScrollMagic

 

Tell them that being able to register gsap would probably be the best solution for npm.

 

Something like this.

import { gsap } from "gsap";
import ScrollMagic from "scrollmagic";
ScrollMagic.registerGSAP(gsap);

 

GSAP has to do do something similar to that for the PixiPlugin when using modules.

https://greensock.com/docs/v3/Plugins/PixiPlugin/static.registerPIXI()

 

 

  • Like 2

Share this post


Link to post
Share on other sites

You can try this. No guarantees though, and it is not a good work around. The order in which files run is important.

 

Import and install gsap in one file. Let's call this "install-gsap.js"

import { gsap } from "gsap";
gsap.install(window); // This will make everythng global.

 

And then do your ScrollMagic stuff in another file.

import "./install-gsap.js";
import ScrollMagic from "scrollmagic";

// Now do your ScrollMagic stuff.

 

But, it would be better if ScrollMagic changed stuff on their end to provide a way to work with gsap 3.

 

cc @GreenSock @ZachSaucier gsap.install() is not in the docs.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you for your answer... I hope that ScrollMagic will soon update the library..

Share this post


Link to post
Share on other sites

Did you try my work around above? I didn't test it out, but It should work in theory.

Share this post


Link to post
Share on other sites
4 hours ago, OSUblake said:

Has onOverwrite been replaced by something else?

Quote

onOverwrite was removed in favor of an onInterrupt callback that fires whenever an animation is killed before it completes. 

 

  • Like 2

Share this post


Link to post
Share on other sites

Oh, sorry about that. That links to a private forum, but this is all it says.

 

image.thumb.png.dd06624e07bb0695f06384f1de0b80a7.png

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×