Jump to content
GreenSock

Kv2

GSAP call function

Go to solution Solved by PointC,

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

I have a simple 3 part animation. The text get animated in, then the photo, but the 3rd part is wrong.  its a call to a function. the function has a TweenMax. from opacity 0,  but the text is showing from the start. then when the function gets called it runs normally. How do I get the text in the .anim-text to not show on page load?

 

Thank you,

 

K

See the Pen XKZBvY by Kv2 (@Kv2) on CodePen

Link to comment
Share on other sites

You can change your opacity to autoAlpha on line 24 of your JS code

autoAlpha: 0,

and also add the CSS to hide your text when the page loads

.container .anim-text [class^="char"]{visibility:hidden;}
Link to comment
Share on other sites

  • Solution

Hi Kv2  :)

 

Since you're using a from() tween for the characters in your function, I'd recommend setting the visibility of your .anim-text div to hidden in your CSS and then in your animpar() function add this line before the each() loop:

TweenMax.set(".anim-text", {autoAlpha:1});

The reason for that is when you set the visibility to hidden in your CSS and then you animate from an autoAlpha of 0, you'd essentially be animating from 0 to 0 and the words would not appear.

 

Here's a fork of your pen with that solution:

 

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

 

Hopefully that helps.

 

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