dawid660 Posted May 21, 2020 Share Posted May 21, 2020 Hi, I have a problem. I would like to rotate the "pot" and other elements around the center of SVG. Is it possible? Currently, when the transformOrigin "50%, 50%", the pot rotates around itself See the Pen wvKNoMr?__cf_chl_jschl_tk__=0ed6abe2b7ab98cff7d0aeecff2b214671bf284d-1590067105-0-AagyNn5hQKzRp7wrR2Q-FrpsynObqIX4q1UodYZ7P88-qq916WeWCre7ItwXh1S1IuceFmI4AbzURkrK18uwymHKwAoFVPqRH4bMOBAy8mDsB-UJOo7nlULL8fCxyBaE0uwBILRTt4liL by dawid660 (@dawid660) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted May 21, 2020 Share Posted May 21, 2020 Hey dawid660 and welcome to the GreenSock forums! This is exactly what the svgOrigin property is for in GSAP. However, in order to use it properly you should remove the transforms that you have on your elements. I did that by running your SVG through Lean-SVG but you could do the same thing in a vector editor like Illustrator or Inkscape. Once you've removed the transform, you just need to set the svgOrigin to the center of your SVG which is easily calculated by dividing the viewbox width and height by 2. See the Pen GRpzNVx?editors=0010 by GreenSock (@GreenSock) on CodePen Note that Lean-SVG removed the extra space around the flower but you can add back if you want to. If you do want to add the space back in the SVG itself I recommend changing the viewbox values. 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