DiegoM Posted October 20, 2020 Share Posted October 20, 2020 Hello! I'm trying to rotate a line that changes the center of rotation. The thing is that when the center is changed it looks like it is affected by the rotation that already was applied to the element. How can I workaround this?Minimal example in CodeSandbox Link to comment Share on other sites More sharing options...
ZachSaucier Posted October 20, 2020 Share Posted October 20, 2020 Hey Diego. I'm not a React guy so I could be wrong here but I think the issue is that in your component the attributes are going to update immediately because you set them: x1={centerX} y1={centerY} x2={centerX + length} y2={centerY} So when you update the centerX and Y it will be set immediately (then GSAP will try to animate to the same value). FYI smoothOrigin is true by default so you don't need to import CSSPlugin or change the value. Link to comment Share on other sites More sharing options...
DiegoM Posted October 20, 2020 Author Share Posted October 20, 2020 Finally I used math to not rotate the line, I hope someone still can help with a workaround for this, thanks! 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