Jump to content
Search Community

My first Tween

SC_74 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 All!
 
Posting my first post here. :-)
 
 
3 simple questions :
 
- How to keep visible top_overlay and bottom_overlay during the « loader » animation?
 
- How to do this tween in reverse mode?
 
- Is there a easier way to write or make this kind of script/transition?
 
 
Thanks so much for any help! :-)

See the Pen aKKLqP by SC-74 (@SC-74) on CodePen

Link to comment
Share on other sites

Like that?


 

    var tl = new TimelineMax();
    tl.add( TweenLite.to(middle_overlay, 2, {delay: 1, display: 'block', width: 0, repeat: 2, yoyo: true}));
    tl.add( TweenLite.to([top_overlay, bottom_overlay], 1, {autoAlpha: 1, height: 0, ease: Power4.easeInOut}));
    tl.add( TweenLite.to([h1, p], 1, {autoAlpha: 1, x: '0%', ease: Power3.easeInOut}));



$('.button1').click(function(event) {
        tl.from([top_overlay, bottom_overlay], 1, {autoAlpha: 1, height: 0, ease: Power4.easeInOut});
        tl.play();
    });

 

Doesn't work!

Link to comment
Share on other sites

1 hour ago, SC_74 said:

Doesn't work!

 

Prove it!

 

if you .play() timeline later, create it {paused:true}. also, i dont get why you use .from() call. also, you can add single tween to timeline using .to() method. also, dont hope that GSAP will handle state management for you, better, control it separately. also, everything you do with jquery there, can be done with plain JS..

 

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