Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Stefano Monteiro

horizontalLoop() Helper

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

  • Solution

This is more of a logic issue than a GSAP question and we really try to keep these forums focused (see the forum guidelines), but perhaps you just need to do: 

xPercent: "+=0"

Does that help? 

Link to comment
Share on other sites

Sorry the topic was off the guidelines. I was thinking the change was going to be in the helper function. That worked perfectly. Thank you very much!

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