Jump to content
Search Community

Sticky animation with ScrollTrigger with issue

Demétrio.Perosi

Go to solution Solved by Rodrigo,

Recommended Posts

Demétrio.Perosi
Posted

Good afternoon, this is my first post in the community, so I apologize in advance if I do anything wrong.
I am having an issue with the "pin" attribute for ScrollTrigger animations, using Elementor Pro. I created an example to demonstrate it.


I created 3 containers with 100vh, and in the central one, I added a text. The animation changes the text opacity from 20% to 100%, and keeps the container fixed during the animation.
The start works fine, the animation is triggered, and the container stays pinned. However, when the animation ends, the container disappears, and after that, it appears from top to bottom, as if it teleports to the position it would be if it weren't pinned, then goes back to its pinned position.
 

I’m not sure what could be causing this. I have more complex animations with horizontal scrolls, and this problem always happens when I set the animation to be pinned.
https://r2u.io/text/
 

<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/ScrollTrigger.min.js"></script>

<script>
gsap.registerPlugin(ScrollTrigger);

gsap.fromTo(".h2", {
    opacity: 0.2
}, {
    opacity: 1,
    scrollTrigger: {
        trigger: ".meuContainer",
        start: "top top",      
        end: "+=100%",        
        scrub: true,      
        markers: true,
        pin: true
    }
});

</script>

 

 

Posted

Without a minimal demo, it's very difficult to troubleshoot; the issue could be caused by CSS, markup, a third party library, a 3rd party script, etc. Would you please provide a very simple CodePen or Stackblitz that illustrates the issue? 

 

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

 

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

that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

 

Using a framework/library like React, Vue, Next, etc.? 

CodePen isn't always ideal for these tools, so here are some Stackblitz starter templates that you can fork and import the gsap-trial NPM package for using any of the bonus plugins: 

 

Please share the StackBlitz link directly to the file in question (where you've put the GSAP code) so we don't need to hunt through all the files. 

 

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

  • Solution
Posted

Hi,

 

I'm far from being a Wordpress/Elementor expert, but this seems to be related to some transition that elementor is adding to the element being animated with GSAP. As soon as I add this using chrome's devtools everything works as expected:

transition: none !important;

You should see a way to create a custom class for that element in order to override the elementor transition.

 

Hopefully this helps

Happy Tweening

Demétrio.Perosi
Posted
4 hours ago, Rodrigo said:

Oi,

 

Estou longe de ser um especialista em Wordpress/Elementor, mas isso parece estar relacionado a alguma transição que o elementor está adicionando ao elemento que está sendo animado com GSAP. Assim que adiciono isso usando o devtools do Chrome, tudo funciona como esperado:

Você verá uma maneira de criar uma classe personalizada para esse elemento para substituir a transição elementor.

 

Espero que isso ajude

Feliz Tweening

How, I would never figure out how to fix it myself.
You are my enchanted prince, thank you very much.

  • Like 1

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