Jump to content
Search Community

Ignore/skip in reverse()

anteksiler 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

Is there anyway we can omit some tweens when doing reverse() ?

 

I have this code

menuTl
					.set($('.header_overlay_padding', header), {marginTop: $('.logolink', header).outerHeight()})
					.to(header_overlay_menu, 0.3, { y: 0 }, "start")
					.set(header, {className: '+=light-header'})
					.staggerFromTo($('.thb-header-menu>li>a', header), 0.5, { autoAlpha: 0 }, { autoAlpha: 1 }, 0.1, 'color')
					.staggerFrom($('.thb-header-menu>li>a', header), 0.3, { color:'#fff', clearProps: 'color' }, 0.1, 'color+=0.5') ***
					.to(bar, 0.5, { cssRule: { scaleX: 1, opacity: '0.1' } }, '-=0.5' )
					.staggerFromTo($('.thb-secondary-menu-container a', header), 0.5, { autoAlpha: 0 }, { autoAlpha: 1 }, 0.1, 'subcolor')
					.staggerFrom($('.thb-secondary-menu-container a', header), 0.3, { color:'#fff', clearProps: 'color' }, 0.1, 'subcolor+=0.5'); ***

 

I would rather not animate the lines marked with *** when doing reverse.

Link to comment
Share on other sites

Thanks, I have moved my timelines into a master timeline, and it's easier to control. However, I have an issue with position parameter of nester timelines.

 

mainTl
	.add(animation1.play(), "position")
	.add(animation2.play(), "position");

 

Now, when playing mainTL,  both animations start together, however, when using mainTl.reverse(), they are staggering. 

 

mainTL, animation1 and 2 are all paused.

Link to comment
Share on other sites

  • 2 months later...
  • 5 years later...

I made this workaround,

const subTween = gsap.to(".text", {
  opacity: 1,
  paused: true,
});

const mainTimeline = gsap
  .timeline()
  .to(".class", {
    opacity: 0,
  })
  .to(".something", {
    yPercent: 200,

    onComplete: () => {
      subTween.play();
    },
  });

onComplete function will only be fired when the timeline on play not on reverse. You can control the time of the sub tween using the delay property. 

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