Jump to content
Search Community

Gradient Text Animation not working ..

unni

Go to solution Solved by mvaneijgen,

Recommended Posts

Posted

I have a sentence with three words, for example:
        Modern Watch Style

I am applying one continuous gradient across the entire sentence using:
background: linear-gradient(to right, #00ff1e 0%, #cf1512 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;



 

So visually, the gradient flows smoothly from the first word to the last.

Now I need to split the sentence into individual words (using GSAP SplitText or similar) so that I can animate each word separately (stagger, transform, etc.).

But its not working correctly . If we are not using the gradient css code then the animation working fine . 
if anyone knows , Please help .

See the Pen XJKemXG by unni-krishnan-the-vuer (@unni-krishnan-the-vuer) on CodePen.

  • unni changed the title to Gradient Text Animation not working ..
  • Solution
mvaneijgen
Posted

I think this is not possible, but that is more to do with how browsers render things then it is has to do with GSAP. SplitText split the words, so now they are no longer the child of your .parent-div and thus the background clip effect is on the wrong element. 

 

A way of doing it is a bit of a fake out, but you can give each letter a color that is between your two gradients, it is not a real gradient because each letter will just have a solid color, but it looks almost the same. This is how I have done it once. 

 

Hope it helps and happy tweening! 

 

See the Pen WbxZpKe?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen.

  • Like 3
Posted

Hi,

 

Just an FYI, if you want to use a more complex gradient you can use an image for the gradient and blend mode in order to achieve that:

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

 

Hopefully this helps

Happy Tweening!

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