Jump to content
Search Community

Having trouble fading out text

InspireUX test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Folks,

 

I'm a newbie and have been learning to use the Timeline for a day now.

So far I've been able to build a sequence of text fading-in, but I'm not finding an easy way/command to get the text to fade out.

 

I think I've done a hack to get the fadeOut to work, but I'd like to know the best way to get this done.

 

All help is appreciated! :)

See the Pen NmgxXV by jaigk (@jaigk) on CodePen

Link to comment
Share on other sites

You'll just need to switch a few of those from() tweens into to() tweens. When you use a from() tween, you're tweening from autoAlpha:0 to its current value (in this case it's 1). If you tween from 0 and then tween to 0 on each line of text, I think you'll get the desired result.

 

See the Pen OGgMdG by PointC (@PointC) on CodePen

 

Is that what you needed it to do? Happy tweening.

:)

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Cool. Glad to hear you solved it. I don't want to throw too much at you as I know you're just getting started, but you can just set a repeat for the timeline like this:

var tl = new TimelineMax({ repeat: -1 });

 

You're also repeating the same code for each group, so a loop would make your life easier. You could probably also use a stagger on those as well to shorten the code.

https://greensock.com/docs/TimelineMax/staggerFrom()

 

Happy tweening.

:)

 

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