Jump to content
Search Community

Animate <p> background color

FLYPILOT test
Moderator Tag

Go to solution Solved by FLYPILOT,

Recommended Posts

I'm having a hard time understanding exactly what you want, but the fundamental problem there was that the backgroundColor is on the parent element, not the things you were animating. If you're trying to animate the backgroundColor of each word, here's a quick demo: 

See the Pen oNawGbv by GreenSock (@GreenSock) on CodePen

 

Hopefully that gets you going in the right direction. 👍

Link to comment
Share on other sites

Thanks @GreenSock this is a half solution that I got here as well. However this don't have the same look as on the pen I've shared. With this we have empty spaces between the words.

 

I think, a lines and words solutions could work for me. 

animate each line and them animate the words for that line, is that even possible?

Link to comment
Share on other sites

  • Solution

Hey guys, thanks for the help.

I've found the solution in my project and I wasn't able to apply to the pen.

However here is the code for the solution:

 

splitTextTimeline
    .from(
      mySplitText.lines, 
      {
        delay: 0.5, 
        backgroundColor: 'transparent', 
        opacity: 0, 
        stagger: 0.35, 
        y: 10, 
        autoAlpha: 0,
      }
    )
    .from(
      mySplitText.words, 
      { 
        stagger: 0.15,
        duration: 0.4, 
        y: 10,
        autoAlpha: 0, 
        ease: "Power1.easeInOut",
      }, 
      "<+=0.2"
    )

 

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