Jump to content
Search Community

scale between zero and one

Gary Griswold 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

Hello,

 

I am trying to get a small scrollable body of text (the table of contents) to appear starting from under the button that is clicked to present the table of contents.  Then I want the table of contents to disappear by a reverse animation back under the button when the user has selected a place in the table of contents.

 

I have a solution that partially works, but if the user has scrolled to the bottom half of the table of contents, the tween to remove the table of contents is happening twice.  Or maybe it is starting, getting interrupted by something, and then finishing.

 

This is a 'single page' mobile app.  So pages of text are being removed from the DOM when the TOC is shown, and added to the DOM when the TOC is removed.

 

I don't know if I could fit the essential ingredients into a codepen, but these are the two tween calls that I am using.

 

Show:

TweenMax.fromTo(this.rootNode, 0.7, { css: {scale:0} }, { css: {scale:1, transformOrigin:"left top"}, ease:Power4.easeOut});

 

Hide:

TweenMax.fromTo(this.rootNode, 0.7, { css: {scale:1} }, { css: {scale:0}});

 

Thanks for any help you can provide.

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