Jump to content
Search Community

SplitText weird animation increasing delay(not wanted)

vlrftps test
Moderator Tag

Recommended Posts

I have weird delay happening when using split text Line animation. So I have 5-6 sections where I gave split text animation on headings and body text. With start of animation:  start: "100px bottom", it is working fine till second or third section, but when I reach the fourth and fifth section the animation is not happening 100px from bottom... it is reaching almost the center of the viewport... Any ideas?  The site is made in Webflow - here is the link. The weirdest thing is that when I moove the section to be Second, the animation works fine...

 

 

 

Img01.jpg

Img02.jpg

Img03.jpg

Link to comment
Share on other sites

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/Nuxt/Gatsby or some other framework, you may find CodeSandbox easier to use. 

 

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 @vlrftps welcome to the forum!

 

That is really weird. We ask for a minimal demo, because we can't debug a live site, there is no way to add or remove code or sometimes even view it, so that makes finding the problem really hard. 

 

If you can't reproduce the bug on Codepen I would recommend disabling CSS and JS on your site in big chunks and try to narrow it down from there, until you've found the culprit. When working with ScrollTrigger also try enabling the markers: true or even disable ScrollTrigger all together, to see if the animation you've build works as expected without the scroll logic. Hope it helps and happy tweening! 

  • Like 2
Link to comment
Share on other sites

Okay I managed to fix it. I found what was making the issue. The problem was related to the element that was set to Relative position and it was pushing the whole animation timeline like 500-600px for some reason, but when I changed the position from relative to absolute it all got fixed... You can see the funciton that I used below. 

$(".need-animated").each(function (index) {
  let triggerElement = $(this);
  let targetElement = $(this);

  let tl = gsap.timeline({
    scrollTrigger: {
      trigger: triggerElement,
      // trigger element - viewport
      start: "bottom 80%",
      end: "top top",
      scrub: 1
    }
  });
 tl.from(
    targetElement,
    {
     fontSize: "8em",
    y: "-190%",
    duration: 1
    },
    {

@mvaneijgen thank you for your help!

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