Jump to content
Search Community

Maybe some noob problem, trying to move a codepen from MaxTween to GSAP 3

NovamIT test
Moderator Tag

Recommended Posts

Hi,

 

I found a very nice testimonial slider on codepen which uses an old version of GSAP (TweenMax 1.19) and I'm trying to convert it to GSAP3 with MotionPath instead of bezier. The original is found here:

See the Pen wvYBGPY by NovamIT (@NovamIT) on CodePen

 

The animations are working, but the Array shift isn't doing anything. In the orginal version a setTimout is being used to shift the testimonials array and restart the animation based on the timeout. I wanted to create a timeline with a repeat function and a repeatDelay. The array shift function i've set on the onRepeat callback property in the timeline. The delay and the repeat are working, but the callback not (It's firing, but not shifting visually).

 

What am I doing wrong?

 

See the Pen gOBbPZW by NovamIT (@NovamIT) on CodePen

Link to comment
Share on other sites

Here's a simple port of the old one: 

See the Pen GRYgZaY?editors=0010 by GreenSock (@GreenSock) on CodePen

 

The onComplete isn't being called when you expect because you're not giving it a function - you're invoking the function immediately and then assigning the result to the onComplete.

 

// BAD
onRepeat: sortArray(cards)

// GOOD
onRepeat: () => sortArray(cards)

// ALSO GOOD
onRepeat: function() { sortArray(cards) }

 

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