Share Posted March 26, 2016 I want to continuously rotate a group inside the svg. I am applying svgOrigin to the tween, but the group is still not centred while rotating. Also, how do we calculate svgOrigin? See the Pen EKXWrJ by shubhra (@shubhra) on CodePen Link to comment Share on other sites More sharing options...
Share Posted March 26, 2016 you can simply use circle cx/cy as svgOrigin reference , so your group center is : svgOrigin: ' 389.74 420.437 ' 2 Link to comment Share on other sites More sharing options...
Author Share Posted March 27, 2016 That did it. Thanks a ton! For my understanding, say there was no circle, how do we center the group then? Also, how do we calculate svgOrigin usually? Link to comment Share on other sites More sharing options...
Share Posted March 27, 2016 Just find the center of whatever you are targeting. So it's own center is... var bbox = $("#leaves")[0].getBBox(); var cx = bbox.x + bbox.width / 2; var cy = bbox.y + bbox.height / 2; 5 Link to comment Share on other sites More sharing options...
Author Share Posted March 28, 2016 Thanks Blake! 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