Jump to content
Search Community

How to use ScrollMagic and GSAP with React

hellodude.it test
Moderator Tag

Recommended Posts

Hi,

I have a problem using GSAP and ScrollMagic in React's project. This is an example:

 

var controller = new ScrollMagic.Controller();

new ScrollMagic.Scene({ triggerElement: this.about }).setTween(TweenMax.to(this.h2, 0.25, { color: 'yellow' })).addTo(controller);

Can you explain me why this operation executes at the start and not when this.about is triggered?

 


Thank you,

a.

Link to comment
Share on other sites

Hey Andrea,

 

Honestly we couldn't tell without a live editable sample to look at. If you can please set up a minimal sample showing just the issue you're having.

 

In the meantime here is a working sample of React+GSAP+Scrollmagic, so you can take a look at (dependencies are a bit outdated though):

 

https://codesandbox.io/s/w7jvzxo9w

 

Happy Tweening!!!

  • Like 5
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...