Jump to content

Hugh Nivers

Large Illustrator Infographic to SVG to Animation

Recommended Posts



First post here so sorry if I'm asking something that has been answered, but I did a search and didn't find what I needed.


Here's my project and what I'd like to do:


  1. Create a large infographic with lots of groups in Illustrator. 
  2. Export the large infographic as ONE large SVG.
  3. Copy the inline SVG code and paste it into the body of an HTML page.
  4. Animate the individual elements of the ONE large SVG.


I've attached a JPG of an example infographic. It contains ten sections. I'd like to be able to access individual SVG elements (e.g. <rect>, <g>, etc.) in each section and animate them using Greensock.


Also, I attached a Codepen with a much simpler SVG with only two sections. I have tried to simply move the white rectangle in the top section but have been unable to. I set the id of the white rectangle to "logo." I'm just using the simple code from the first Jump Start tutorial.


I'd like to be able to animate each of these elements on hover, clicking, etc. For example, in the codepen, I'd like to be able to rotate the wheel by clicking the "click me" button.




See the Pen VxbYva by hughnivers (@hughnivers) on CodePen

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums,


Thanks for the demo.


The problem is that svg elements do not honor css positioning like top and left.

You can however animate the transform value, which in this case would be "x"

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





  • Like 3
Link to comment
Share on other sites

HI @Hugh Nivers :)


Welcome to the forum. 


In addition to @Carl's excellent advice, I'll throw out a bit of info for you. There is some crossover between CSS properties and SVG attributes. These two lines will produce very different results in your SVG:


TweenLite.to("#logo", 1, { x:600 });
TweenLite.to("#logo", 1, { attr:{x:600} });


If you're after those SVG attributes, you'd want to wrap them like above and use the attribute plugin (which is automatically included with TweenMax).


You mentioned clicking the button to tween the wheel so I added that to my fork for you.

See the Pen aGWdmo by PointC (@PointC) on CodePen

Hopefully that gets you started. Happy tweening and welcome aboard.



  • Like 4
Link to comment
Share on other sites

Thank you Carl. That was easy. :)


 If I want to make it so the white rectangle scale on hover in the Y dimension only, I'll need to transform the origin to the bottom center of the rectangle. I did this before with CSS about a year ago and then it broke. Code rot? How would I do that as a transform or is there another/better way? Thx.

Link to comment
Share on other sites

For some reason, Greensock is animating differently in the browser than in Codepen. Here's a video showing the difference: 


Link to comment
Share on other sites

Hello @Hugh Nivers

For more on SVG export


One extra tip if you want to export the WHOLE artboard with different layers etc you can export it by 

Also using Presentation attributes will save you a lot of headaches 









Happy tweening :) 


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