Jump to content
Search Community

Repeat timeline but pause in middle animation

jiggy1965 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

var tl = new TimelineMax({repeat:2});
btn = new TimelineMax();
// start animation

tl.from("#text1", 1.5, {x:-340, ease: Back.easeOut.config(1.7), scale:2}, "start+=.5");
tl.from("#text2", 1.5, {x:-340, ease: Back.easeOut.config(1.7), scale:2}, "start+=1");
tl.from("#text3", 1.5, {x:-340, ease: Back.easeOut.config(1.7), scale:2}, "start+=1.5");
tl.from("#text4", 1.5, {x:-340, ease: Back.easeOut.config(1.7), scale:2}, "start+=2");

tl.to("#text1", 1.5, {opacity:0}, "start+=5");
tl.to("#text2", 1.5, {opacity:0}, "start+=5");
tl.to("#text3", 1.5, {opacity:0}, "start+=5");
tl.to("#text4", 1.5, {opacity:0}, "start+=5");

 

So I have above animation. Some texts that slide in and fade out. I'm having this repeated twice, but during the last loop it shouldn't fade out but pauze in the middle so the text stay on screen at the end. How would I have to do that?

Link to comment
Share on other sites

Never mind, already found out :-)

var loop=1;	
var tl = new TimelineMax({repeat:1});
btn = new TimelineMax();
// start animation

tl.from("#text1", 1.5, {x:-340, ease: Back.easeOut.config(1.7), scale:2}, "start+=.5");
tl.from("#text2", 1.5, {x:-340, ease: Back.easeOut.config(1.7), scale:2}, "start+=1");
tl.from("#text3", 1.5, {x:-340, ease: Back.easeOut.config(1.7), scale:2}, "start+=1.5");
tl.from("#text4", 1.5, {x:-340, ease: Back.easeOut.config(1.7), scale:2}, "start+=2");

tl.add( function(){if(loop==2){tl.stop()} else {loop++}})


tl.to("#text1", 1.5, {opacity:0}, "start+=5");
tl.to("#text2", 1.5, {opacity:0}, "start+=5");
tl.to("#text3", 1.5, {opacity:0}, "start+=5");
tl.to("#text4", 1.5, {opacity:0}, "start+=5");

 

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