Jump to content
Search Community

Triggering SpliText on multiple classes with ScrollMagic

Lorenzo Bocchi test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hey everyone, 

I'm stuck with ScrollMagic and SplitText. 

I'm using SplitText for many classes. I need to replicate the same function all over again in the same page. 

All the other animations are fine, except for SplitText.

splitTextBody = new SplitText(".split-text-body", {type:"words"}),
wordsbody = splitTextBody.words;

  $('section').each(function(){

    var textBlock = new TimelineMax();
    textBlock.add(TweenMax.to($(this).find('.underline-body'), .75, {x:0, ease:Expo.easeOut}))
             .add(TweenMax.staggerFrom($(this).find(wordsbody), 0.8, {opacity:0, y:"100%", ease: Expo.easeOut}, 0.012))
             .add(TweenMax.staggerTo($(this).find('.underline-form'), .75, {x:0, ease:Expo.easeOut}, 0.12), '=-1');

    var scene = new ScrollMagic.Scene({
      triggerElement: this,
      duration: 0,
      offset: 0,
    })

    .setTween(textBlock)
    .addTo(controller)
    });

I'm able to call SpliText with no problem when it's just one for each page.
But not in this case. When I have classes like this I'm not able to figure it out. 

 

Thanks in advance for the help! 

Cheers.

 

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