Jump to content
Search Community

Problem with animation and function

pattocheu test
Moderator Tag

Recommended Posts

Hello,

I desperately try to animate the "Split2" class but only the "split1" class works.

 

After the first "gsap.to" I included a function ( .call(createSplitText()) to animate the "h2" tags but in the timeline only the h2 of "split1" is functional, and I don't see my error.

 

Thanks for your help.

 

ps: Thank you for the nice SplitText: Random Words find on CodePen.

See the Pen poEmXab?editors=1111 by pattocheu (@pattocheu) on CodePen

Link to comment
Share on other sites

I'm not quite sure about the end result here, but if I understand your question correctly, you need to make a slight adjustment.

 

When you call your createSplitText() function you'd want to add the parameter of your target class

.call(createSplitText, [split])

 

Then you can make this change at the beginning of that function.

/*-- SplitText function --*/
function createSplitText(target) {
  let mySplitText = new SplitText(target, { type: "words" }),

I think that should work for you. Happy tweening.

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