Jump to content
Search Community

horizontalLoop() Helper

Stefano Monteiro test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

I am using the horizontalLoop() helper demo on Codepen and I wanted to add an animation out on the current slide. I did add a rotationY and opacity successfully. I would like though, to have the the animated slide to not move to the left. I believe the change must be on the helper function, maybe add a condition (if is current slide)?

 

Any help is appreciated, thanks.

 

This is the code I added so far:

 const magnets = gsap.utils.toArray('.magnet')
  const currentMagnet = loop.current()-1 >= 0 ? loop.current()-1 : magnets.length -1
  const animatedMagnet = magnets[currentMagnet]
  const animateTL = gsap.timeline({onComplete:()=> gsap.set(animatedMagnet,{opacity:1, rotateY:0,delay:2})});
  animateTL.to(animatedMagnet, {
    // xPercent:0,
    rotateY: 75
  }).to(animatedMagnet, {
    opacity:0,
  }, '<')
   

 

See the Pen NWjOdRx by stefanomonteiro (@stefanomonteiro) on CodePen

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