Jump to content
Search Community

multiple callbacks

artstyle test
Moderator Tag

Recommended Posts

const s2_enter = gsap.timeline({paused:truedefaults: {opacity: 0,ease: "expo.inOut"}})
.from(".s2-block-left",{xPercent:-100,duration: 1})
.from(".s2-block-right",{xPercent:100,duration: 1},"<")
.from(".section2-text2",{x: -500,duration: 1})
.from(".section2-heading",{x:-300,duration: 1},"<")
.from(".s2-img1",{x:1000,duration: 0.5},"<")
.from(".s2-img2",{x:1000,duration: 0.5},"<")
.from(".s2-triangle",{duration:0.5,},"<");
 
const s2_exit = gsap.timeline({paused:truedefaults: {opacity: 1}})
.to(".s2",{opacity: 0});
 
const s2_timeline = gsap.timeline({ scrollTrigger: {
    trigger: ".s2",
    scrub: 1.5,
    start: "top top",
    end: "bottom top",
    pin: true,
    toggleActions: "play reverse play reverse",
    onEnter: () => s2_enter.play(),
    onLeaveBack: () => s2_exit.play(),
}
});
 

Hello. how can i play multiple animations on callback?
1. i want to play onEnter only entering animation s2_enter

2. onLeaveBack i want to play fade out animation s2_exit

3. now because the s2_exit animation made .s2 block invisible(opacity 0 )
i want to play 2 different animations s2_enter and s2_exit-reverse

what is the best way to do this?

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