DLong Posted April 24, 2021 Share Posted April 24, 2021 I have some problems with this try to use GSAP 3 but It didn't work. Anyone gives me solution ? See the Pen RwKvbKQ by longd (@longd) on CodePen Link to comment Share on other sites More sharing options...
GreenSock Posted April 24, 2021 Share Posted April 24, 2021 I noticed a few things: You had a bad value: // BAD x: "+= + ${somePI}", // GOOD x: `+=${somePI}`, // ALSO GOOD x: "+=" + somePI, Your modifier was returning NaN because the "x" value that gets passed in is a string with units, like "0px", so Math.cos("0px") is NaN. You're using the old syntax where the duration is the 2nd parameter. It still works, but I'd encourage you to move to the more modern syntax where "duration" is in the vars. You don't need your own random() function - GSAP has that built in. gsap.utils.random(). Here's a fork with the corrections in place: See the Pen KKaJPbp?editors=0010 by GreenSock (@GreenSock) on CodePen Does that clear things up? 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now