unni Posted January 25 Posted January 25 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.
Solution mvaneijgen Posted January 25 Solution Posted January 25 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. 3
Rodrigo Posted January 27 Posted January 27 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! 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now