Jump to content
Search Community

Splitext with gradient

ricky777 test
Moderator Tag

Recommended Posts

Hi tween buddies, 

 

i found a problem with splitext, I have an animation where the text has a gradient and at the end of it I'm reverting the text. During it the gradient there is but at the end on safari, the text disappears the same thing happens on a chrome smartphone... do you know why? what I doing wrong? 


  var from_bottom = ('.hero-title');
  var body = ('.cp-desc-text');
  var cta = ('.btn-primary');

  const innerSplit = new SplitText(from_bottom, {
    type: "lines",
    linesClass: "split_inner"
  })

  const belowSplit= new SplitText(body, {
    type: "lines",
    linesClass: "split_body"
  })

  const splitTimeline = gsap.timeline(
    {
      scrollTrigger: {
        trigger: this,
        markers: true
      },

      onComplete: () => {
        innerSplit.revert()
        belowSplit.revert()
      }
    });


  splitTimeline.from(innerSplit.lines, {
    duration: 0.8, 
    opacity:0, 
    rotationX:-120, 
    force3D:true, 
    transformOrigin:"50% 0% -150", 
    stagger: 0.3
  }, 0.4);

  if(body){
    splitTimeline.from(belowSplit.lines, {
      duration: 0.6, 
      opacity:0, 
      rotationX:-120, 
      force3D:true, 
      transformOrigin:"50% 0% -150", 
      stagger: 0.1
    }, 0.9);
  }
  if(cta){
    splitTimeline.from(cta, {
      duration: 0.6, 
      opacity:0, 
      rotationX:-20, 
      force3D:true, 
      transformOrigin:"50% 0% -150", 
      stagger: 0.7
    }, 1.2);
  }

See the Pen KKXBzOQ by r-giuntinidesign (@r-giuntinidesign) on CodePen

Link to comment
Share on other sites

48 minutes ago, Cassie said:

Hi there! 

 

There's nothing wrong with that code that I can see, and this certainly sounds like a CSS styling/browser compatibility issue rather than an issue with GSAP. 

 

If you post a minimal demo someone may be able to help you out.

 

Yes maybe could be related to CSS styling/browser compatibility... but i got lost... i don't what the problem comes from... i'm very tired about that.... anyway i tried to upload my code on codepen....but maybe i made a mistake.... :) 

  • Like 1
Link to comment
Share on other sites

53 minutes ago, Cassie said:

Hi there! 

 

There's nothing wrong with that code that I can see, and this certainly sounds like a CSS styling/browser compatibility issue rather than an issue with GSAP. 

 

If you post a minimal demo someone may be able to help you out.

but the text disappear when the splitext doing the revert :(

Link to comment
Share on other sites

9 minutes ago, PointC said:
trigger: ".cp-animation",

yes sorry for my bad codepen.... but the problem is on mobile and safari compatibility.... after the revert splitext the text disappear.... but i don't know why... i don't think the problem related to css could you help me on that ?

Link to comment
Share on other sites

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#caeb00",endColorstr="#f89840",GradientType=1);

^ Not sure what that is but it looks pretty terrifying.

 

Also if you're reverting it, you're not going to want to hang styles off dynamic classes that split-text adds, as those will be removed.

Maybe try...
 

.hero-title, .hero-title > * {
}

instead of

.hero-title, .split_inner {
}

 

See the Pen oNGMzXW?editors=0010 by GreenSock (@GreenSock) on CodePen

  • Like 1
Link to comment
Share on other sites

I do see this disappearing on revert. I'm on PC so the only Safari I can test is on my iPad, but is does indeed disappear. Kinda weird. Googling Safari and problems with gradient text yields quite a few hits so it may be browser thing. Then again, it works before the split and during the animation. 

 

I'm kinda stumped on this one? 🤷‍♂️

  • Like 2
Link to comment
Share on other sites

5 minutes ago, Cassie said:
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#caeb00",endColorstr="#f89840",GradientType=1);

^ Not sure what that is but it looks pretty terrifying.

 

Also if you're reverting it, you're not going to want to hang styles off dynamic classes that split-text adds, as those will be removed.

Maybe try...
 

.hero-title, .hero-title > * {
}

instead of

.hero-title, .split_inner {
}

 

 

 

yes I did a lot of changes and the class CSS that you mentioned is a bug.... but I found a solution that I don't understand why. But resolved my problem...... i putted in .hero-title this style and the problem seems to be resolved ---> text-shadow: 0px 0px #00000000; <---

  • Like 1
Link to comment
Share on other sites

2 hours ago, Cassie said:

Hi there! 

 

There's nothing wrong with that code that I can see, and this certainly sounds like a CSS styling/browser compatibility issue rather than an issue with GSAP. 

 

If you post a minimal demo someone may be able to help you out.

 

Thax @Cassie and @PointC in the next few days, I'll browse and I'll try to understand the better way to do that :)

 

 

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